Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Defaults from ECORE model don't appear in XML data from diagram.
Defaults from ECORE model don't appear in XML data from diagram. [message #115906] Mon, 02 April 2007 05:00 Go to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears in
the diagram ok BUT doesn't appear in the XML data output from the diagram.
I'm guessing its because the attribute changed event is never generated so
its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the diagram
event if they do not have a value - is that easy to do ?

Stuart
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116077 is a reply to message #115906] Mon, 02 April 2007 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Stu,

Features for which eIsSet returns false will not be serialized so
generally default values will not be serialized. You can use the save
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
serialized.


Stu wrote:
> Not sure if this is a bug or not.
>
> I have put a default in the ecore model for an attribute, its appears in
> the diagram ok BUT doesn't appear in the XML data output from the diagram.
> I'm guessing its because the attribute changed event is never generated so
> its not expected to be anything other that it's initial value.
> I would like all attibutes to appear in the XML data output from the diagram
> event if they do not have a value - is that easy to do ?
>
> Stuart
>
>
>
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116251 is a reply to message #116077] Mon, 02 April 2007 14:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for my
project but how do I use this save option you mention below?

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:euqps3$55v$2@build.eclipse.org...
> Stu,
>
> Features for which eIsSet returns false will not be serialized so
> generally default values will not be serialized. You can use the save
> option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
> serialized.
>
>
> Stu wrote:
>> Not sure if this is a bug or not.
>>
>> I have put a default in the ecore model for an attribute, its appears in
>> the diagram ok BUT doesn't appear in the XML data output from the
>> diagram.
>> I'm guessing its because the attribute changed event is never generated
>> so its not expected to be anything other that it's initial value.
>> I would like all attibutes to appear in the XML data output from the
>> diagram event if they do not have a value - is that easy to do ?
>>
>> Stuart
>>
>>
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116287 is a reply to message #116251] Mon, 02 April 2007 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040803090702040204040307
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stu,

You can override the createResource method of the XyzResourceFactoryImpl
to include this as a default save option.


Stu wrote:
> Ed,
> Thanks for the reply. I see I have a ResourceImpl which is specific for my
> project but how do I use this save option you mention below?
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:euqps3$55v$2@build.eclipse.org...
>
>> Stu,
>>
>> Features for which eIsSet returns false will not be serialized so
>> generally default values will not be serialized. You can use the save
>> option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
>> serialized.
>>
>>
>> Stu wrote:
>>
>>> Not sure if this is a bug or not.
>>>
>>> I have put a default in the ecore model for an attribute, its appears in
>>> the diagram ok BUT doesn't appear in the XML data output from the
>>> diagram.
>>> I'm guessing its because the attribute changed event is never generated
>>> so its not expected to be anything other that it's initial value.
>>> I would like all attibutes to appear in the XML data output from the
>>> diagram event if they do not have a value - is that easy to do ?
>>>
>>> Stuart
>>>
>>>
>>>
>
>
>


--------------040803090702040204040307
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">
Stu,<br>
<br>
You can override the createResource method of the
XyzResourceFactoryImpl to include this as a default save option.<br>
<br>
<br>
Stu wrote:
<blockquote cite="mideur2vb$gvf$1@build.eclipse.org" type="cite">
<pre wrap="">Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for my
project but how do I use this save option you mention below?

"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:euqps3$55v$2@build.eclipse.org">news:euqps3$55v$2@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Stu,

Features for which eIsSet returns false will not be serialized so
generally default values will not be serialized. You can use the save
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
serialized.


Stu wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears in
the diagram ok BUT doesn't appear in the XML data output from the
diagram.
I'm guessing its because the attribute changed event is never generated
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the
diagram event if they do not have a value - is that easy to do ?

Stuart


</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

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

--------------040803090702040204040307--
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116349 is a reply to message #116287] Mon, 02 April 2007 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

This is a multi-part message in MIME format.

------=_NextPart_000_004F_01C7758C.8EC7D2C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ed,
Sorry mate, still struggling here with this one.
Maybe a code example would help.

Im at the createResource(URI) method in the =
<myProject>ResourceFactoryImpl but not sure what to do to include this =
save option.

Stu
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:eur3af$hs3$1@build.eclipse.org...
Stu,

You can override the createResource method of the =
XyzResourceFactoryImpl to include this as a default save option.


Stu wrote:=20
Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for =
my=20
project but how do I use this save option you mention below?

"Ed Merks" <merks@ca.ibm.com> wrote in message=20
news:euqps3$55v$2@build.eclipse.org...
Stu,

Features for which eIsSet returns false will not be serialized so=20
generally default values will not be serialized. You can use the save=20
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be=20
serialized.


Stu wrote:
Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears =
in=20
the diagram ok BUT doesn't appear in the XML data output from the=20
diagram.
I'm guessing its because the attribute changed event is never generated=20
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the=20
diagram event if they do not have a value - is that easy to do ?

Stuart


=20

=20

------=_NextPart_000_004F_01C7758C.8EC7D2C0
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.16414" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sorry mate, still struggling here with =
this=20
one.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Maybe a code example would =
help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Im at the createResource(URI) method in =
the=20
&lt;myProject&gt;ResourceFactoryImpl but not sure what to do to include =
this=20
save option.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Stu</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:eur3af$hs3$1@build.eclipse.org">news:eur3af$hs3$1@build.ecli=
pse.org</A>...</DIV>Stu,<BR><BR>You=20
can override the createResource method of the XyzResourceFactoryImpl =
to=20
include this as a default save option.<BR><BR><BR>Stu wrote:=20
<BLOCKQUOTE cite=3Dmideur2vb$gvf$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for =
my=20
project but how do I use this save option you mention below?

"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</A> wrote in =
message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:euqps3$55v$2@build.eclipse.org">news:euqps3$55v$2@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Stu,

Features for which eIsSet returns false will not be serialized so=20
generally default values will not be serialized. You can use the save=20
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be=20
serialized.


Stu wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Not sure if this is a bug =
or not.

I have put a default in the ecore model for an attribute, its appears =
in=20
the diagram ok BUT doesn't appear in the XML data output from the=20
diagram.
I'm guessing its because the attribute changed event is never generated=20
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the=20
diagram event if they do not have a value - is that easy to do ?

Stuart


</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004F_01C7758C.8EC7D2C0--
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116364 is a reply to message #116349] Mon, 02 April 2007 18:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010900090300010209020404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stu,

Like this:

/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated *NOT*
*/
@Override
public Resource createResource(URI uri)
{
XMLResource result = new LibraryResourceImpl(uri);

*result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_ DEFAULT_CONTENT,
Boolean.TRUE);*


result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);

result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);


result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);


result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);

result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);


result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);
return result;
}


Stu wrote:
> Ed,
> Sorry mate, still struggling here with this one.
> Maybe a code example would help.
>
> Im at the createResource(URI) method in the
> <myProject>ResourceFactoryImpl but not sure what to do to include this
> save option.
>
> Stu
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:eur3af$hs3$1@build.eclipse.org...
> Stu,
>
> You can override the createResource method of the
> XyzResourceFactoryImpl to include this as a default save option.
>
>
> Stu wrote:
>> Ed,
>> Thanks for the reply. I see I have a ResourceImpl which is specific for my
>> project but how do I use this save option you mention below?
>>
>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>> news:euqps3$55v$2@build.eclipse.org...
>>
>>> Stu,
>>>
>>> Features for which eIsSet returns false will not be serialized so
>>> generally default values will not be serialized. You can use the save
>>> option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
>>> serialized.
>>>
>>>
>>> Stu wrote:
>>>
>>>> Not sure if this is a bug or not.
>>>>
>>>> I have put a default in the ecore model for an attribute, its appears in
>>>> the diagram ok BUT doesn't appear in the XML data output from the
>>>> diagram.
>>>> I'm guessing its because the attribute changed event is never generated
>>>> so its not expected to be anything other that it's initial value.
>>>> I would like all attibutes to appear in the XML data output from the
>>>> diagram event if they do not have a value - is that easy to do ?
>>>>
>>>> Stuart
>>>>
>>>>
>>>>
>>
>>
>>
>


--------------010900090300010209020404
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">
Stu,<br>
<br>
Like this:<br>
<blockquote><small>&nbsp; /**</small><br>
<small>&nbsp;&nbsp; * Creates an instance of the resource.</small><br>
<small>&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * @generated <b>NOT</b></small><br>
<small>&nbsp;&nbsp; */</small><br>
<small>&nbsp; @Override</small><br>
<small>&nbsp; public Resource createResource(URI uri)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; XMLResource result = new LibraryResourceImpl(uri);</small><br>
<small>&nbsp;&nbsp;&nbsp; <b> result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CONTENT,
Boolean.TRUE);</b></small><br>
<small>&nbsp;&nbsp;&nbsp; </small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp; return result;</small><br>
<small>&nbsp; }</small><br>
</blockquote>
<br>
Stu wrote:
<blockquote cite="mideur693$ao9$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.6000.16414" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Ed,</font></div>
<div><font face="Arial" size="2">Sorry mate, still struggling here
with this one.</font></div>
<div><font face="Arial" size="2">Maybe a code example would help.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Im at the createResource(URI) method
in the &lt;myProject&gt;ResourceFactoryImpl but not sure what to do to
include this save option.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Stu</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
wrote in message <a href="news:eur3af$hs3$1@build.eclipse.org">news:eur3af$hs3$1@build.eclipse.org</a>...</div>
Stu,<br>
<br>
You can override the createResource method of the
XyzResourceFactoryImpl to include this as a default save option.<br>
<br>
<br>
Stu wrote:
<blockquote cite="mideur2vb$gvf$1@build.eclipse.org" type="cite">
<pre wrap="">Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for my
project but how do I use this save option you mention below?

"Ed Merks" <a class="moz-txt-link-rfc2396E"
href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext"
href="news:euqps3$55v$2@build.eclipse.org">news:euqps3$55v$2@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Stu,

Features for which eIsSet returns false will not be serialized so
generally default values will not be serialized. You can use the save
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
serialized.


Stu wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears in
the diagram ok BUT doesn't appear in the XML data output from the
diagram.
I'm guessing its because the attribute changed event is never generated
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the
diagram event if they do not have a value - is that easy to do ?

Stuart


</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

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

--------------010900090300010209020404--
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116374 is a reply to message #116364] Tue, 03 April 2007 03:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C775F1.7A522380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ok.
I have my <project>ResourceImpl
and it already overrides the createResource method and create a =
Resource.
See below:-
/**

* Creates an instance of the resource.

* <!-- begin-user-doc -->

* <!-- end-user-doc -->

* @generated

*/

@Override

public Resource createResource(URI uri) {

Resource result =3D new RulesstepbystepmodelResourceImpl(uri);

return result;

}

I replace this with:-

/**

* Creates an instance of the resource.

* <!-- begin-user-doc -->

* <!-- end-user-doc -->

* @generated NOT

*/

@Override

public Resource createResource(URI uri) {

XMLResource result =3D new RulesstepbystepmodelResourceImpl(uri);

=
result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CONTEN=
T, Boolean.TRUE);

return result;

}

I regenerate the diagram code (not sure I need to but I did), and =
launched the plugin test.

I create a new diagram and add a node and save (the defaults appear on =
the diagram as expected - these were setup in the ECORE file)

I check the XML Data file for the diagram and the defaults are not in =
there.

Is there something I can missing here,

Stuart

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:eurh3g$9r0$2@build.eclipse.org...
Stu,

Like this:

/**
* Creates an instance of the resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public Resource createResource(URI uri)
{
XMLResource result =3D new LibraryResourceImpl(uri);
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CONTEN=
T, Boolean.TRUE);
=20
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,=
Boolean.TRUE);
=
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,=
Boolean.TRUE);

=
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION, =
Boolean.TRUE);

=
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBU=
TE_STYLE, Boolean.TRUE);
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBU=
TE_STYLE, Boolean.TRUE);

=
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER=
, Boolean.TRUE);
return result;
}


Stu wrote:=20
Ed,
Sorry mate, still struggling here with this one.
Maybe a code example would help.

Im at the createResource(URI) method in the =
<myProject>ResourceFactoryImpl but not sure what to do to include this =
save option.

Stu
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:eur3af$hs3$1@build.eclipse.org...
Stu,

You can override the createResource method of the =
XyzResourceFactoryImpl to include this as a default save option.


Stu wrote:=20
Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for =
my=20
project but how do I use this save option you mention below?

"Ed Merks" <merks@ca.ibm.com> wrote in message=20
news:euqps3$55v$2@build.eclipse.org...
Stu,

Features for which eIsSet returns false will not be serialized so=20
generally default values will not be serialized. You can use the save=20
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be=20
serialized.


Stu wrote:
Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears =
in=20
the diagram ok BUT doesn't appear in the XML data output from the=20
diagram.
I'm guessing its because the attribute changed event is never generated=20
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the=20
diagram event if they do not have a value - is that easy to do ?

Stuart


=20

=20



------=_NextPart_000_000B_01C775F1.7A522380
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.16414" name=3DGENERATOR></HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Ok.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have my =
&lt;project&gt;ResourceImpl</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>and it already overrides the =
createResource method=20
and create a Resource.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>See below:-</FONT></DIV>
<DIV><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf =
size=3D2>/**</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>Creates</FONT><FONT size=3D2> =
</FONT><FONT=20
color=3D#3f5fbf size=3D2>an</FONT><FONT size=3D2> </FONT><FONT =
color=3D#3f5fbf=20
size=3D2>instance</FONT><FONT size=3D2> </FONT><FONT color=3D#3f5fbf=20
size=3D2>of</FONT><FONT size=3D2> </FONT><FONT color=3D#3f5fbf =
size=3D2>the</FONT><FONT=20
size=3D2> </FONT><FONT color=3D#3f5fbf =
size=3D2>resource.</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>&lt;!-- begin-user-doc =
--&gt;</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>&lt;!-- end-user-doc =
--&gt;</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><B><FONT color=3D#7f9fbf size=3D2>@generated</P></B></FONT><FONT =
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*/</P></FONT><FONT =
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#646464 =
size=3D2>@Override</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>public</B></FONT><FONT=20
size=3D2> Resource createResource(URI uri) {</P>
<P align=3Dleft>Resource result =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2> =
RulesstepbystepmodelResourceImpl(uri);</P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>return</B></FONT><FONT=20
size=3D2> result;</P>
<P align=3Dleft>}</P>
<P align=3Dleft>I replace this with:-</P><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf =
size=3D2>/**</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>Creates</FONT><FONT size=3D2> =
</FONT><FONT=20
color=3D#3f5fbf size=3D2>an</FONT><FONT size=3D2> </FONT><FONT =
color=3D#3f5fbf=20
size=3D2>instance</FONT><FONT size=3D2> </FONT><FONT color=3D#3f5fbf=20
size=3D2>of</FONT><FONT size=3D2> </FONT><FONT color=3D#3f5fbf =
size=3D2>the</FONT><FONT=20
size=3D2> </FONT><FONT color=3D#3f5fbf =
size=3D2>resource.</P></FONT><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>&lt;!-- begin-user-doc =
--&gt;</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#3f5fbf size=3D2>&lt;!-- end-user-doc =
--&gt;</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*</FONT><FONT =
size=3D2>=20
</FONT><B><FONT color=3D#7f9fbf size=3D2>@generated =
NOT</P></B></FONT><FONT size=3D2>
<P align=3Dleft></FONT><FONT color=3D#3f5fbf size=3D2>*/</P></FONT><FONT =
size=3D2>
<P align=3Dleft></FONT><FONT color=3D#646464 =
size=3D2>@Override</P></FONT><FONT=20
size=3D2>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>public</B></FONT><FONT=20
size=3D2> Resource createResource(URI uri) {</P>
<P align=3Dleft>XMLResource result =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2>=20
RulesstepbystepmodelResourceImpl(uri);</FONT></P>
<P align=3Dleft><FONT size=3D2><FONT face=3DArial><FONT=20
face=3D"Times New Roman">&nbsp;&nbsp;&nbsp;=20
<B> result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CON=
TENT,=20
Boolean.TRUE);</B></FONT></FONT></P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>return</B></FONT><FONT=20
size=3D2> result;</P>
<P align=3Dleft>}</P>
<P align=3Dleft><FONT face=3DArial>I regenerate the diagram code (not =
sure I need to=20
but I did), and launched the plugin test.</FONT></P>
<P align=3Dleft><FONT face=3DArial>I create a new diagram and add a node =
and save=20
(the defaults appear on the diagram as expected - these were setup in =
the ECORE=20
file)</FONT></P>
<P align=3Dleft><FONT face=3DArial>I check the XML Data file for the =
diagram and the=20
defaults are not in there.</FONT></P>
<P align=3Dleft><FONT face=3DArial>Is there something I can missing =
here,</FONT></P>
<P align=3Dleft><FONT face=3DArial>Stuart</FONT></P></FONT></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:eurh3g$9r0$2@build.eclipse.org">news:eurh3g$9r0$2@build.ecli=
pse.org</A>...</DIV>Stu,<BR><BR>Like=20
this:<BR>
<BLOCKQUOTE><SMALL>&nbsp; /**</SMALL><BR><SMALL>&nbsp;&nbsp; * Creates =
an=20
instance of the resource.</SMALL><BR><SMALL>&nbsp;&nbsp; * &lt;!--=20
begin-user-doc --&gt;</SMALL><BR><SMALL>&nbsp;&nbsp; * &lt;!-- =
end-user-doc=20
--&gt;</SMALL><BR><SMALL>&nbsp;&nbsp; * @generated=20
<B>NOT</B></SMALL><BR><SMALL>&nbsp;&nbsp; =
*/</SMALL><BR><SMALL>&nbsp;=20
@Override</SMALL><BR><SMALL>&nbsp; public Resource =
createResource(URI=20
uri)</SMALL><BR><SMALL>&nbsp; {</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp; =

XMLResource result =3D new=20
LibraryResourceImpl(uri);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
<B> result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CON=
TENT,=20
Boolean.TRUE);</B></SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,=
=20
Boolean.TRUE);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,=
=20
Boolean.TRUE);</SMALL><BR><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,=20
Boolean.TRUE);</SMALL><BR><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBU=
TE_STYLE,=20
Boolean.TRUE);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBU=
TE_STYLE,=20
Boolean.TRUE);</SMALL><BR><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
=
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER=
,=20
Boolean.TRUE);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp; return=20
result;</SMALL><BR><SMALL>&nbsp; }</SMALL><BR></BLOCKQUOTE><BR>Stu =
wrote:=20
<BLOCKQUOTE cite=3Dmideur693$ao9$1@build.eclipse.org type=3D"cite">
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR>
<STYLE></STYLE>

<DIV><FONT face=3DArial size=3D2>Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sorry mate, still struggling here =
with this=20
one.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Maybe a code example would =
help.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Im at the createResource(URI) =
method in the=20
&lt;myProject&gt;ResourceFactoryImpl but not sure what to do to =
include this=20
save option.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Stu</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A=20
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt; wrote in =
message=20
<A=20
=
href=3D"news:eur3af$hs3$1@build.eclipse.org">news:eur3af$hs3$1@build.ecli=
pse.org</A>...</DIV>Stu,<BR><BR>You=20
can override the createResource method of the =
XyzResourceFactoryImpl to=20
include this as a default save option.<BR><BR><BR>Stu wrote:=20
<BLOCKQUOTE cite=3Dmideur2vb$gvf$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for =
my=20
project but how do I use this save option you mention below?

"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</A> wrote in =
message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:euqps3$55v$2@build.eclipse.org">news:euqps3$55v$2@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Stu,

Features for which eIsSet returns false will not be serialized so=20
generally default values will not be serialized. You can use the save=20
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be=20
serialized.


Stu wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Not sure if this is a =
bug or not.

I have put a default in the ecore model for an attribute, its appears =
in=20
the diagram ok BUT doesn't appear in the XML data output from the=20
diagram.
I'm guessing its because the attribute changed event is never generated=20
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the=20
diagram event if they do not have a value - is that easy to do ?

Stuart


</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

=
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BLOCKQUOTE><BR></BLOCKQUOTE ></BODY>=
</HTML>

------=_NextPart_000_000B_01C775F1.7A522380--
Re: Defaults from ECORE model don't appear in XML data from diagram. [message #116413 is a reply to message #116374] Tue, 03 April 2007 10:55 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080803090008060807090202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stu,

Is this resource you've overridden actual being used to save your XML
data file? Check when the save happens that the option is actually set
in the resource's defaultSaveOptions map.


Stu wrote:
> Ok.
> I have my <project>ResourceImpl
> and it already overrides the createResource method and create a Resource.
> See below:-
>
> /**
>
> * Creates an instance of the resource.
>
> * <!-- begin-user-doc -->
>
> * <!-- end-user-doc -->
>
> * *@generated*
>
> */
>
> @Override
>
> *public* Resource createResource(URI uri) {
>
> Resource result = *new* RulesstepbystepmodelResourceImpl(uri);
>
> *return* result;
>
> }
>
> I replace this with:-
>
> /**
>
> * Creates an instance of the resource.
>
> * <!-- begin-user-doc -->
>
> * <!-- end-user-doc -->
>
> * *@generated NOT*
>
> */
>
> @Override
>
> *public* Resource createResource(URI uri) {
>
> XMLResource result = *new* RulesstepbystepmodelResourceImpl(uri);
>
>
> *result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_ DEFAULT_CONTENT,
> Boolean.TRUE);*
>
> *return* result;
>
> }
>
> I regenerate the diagram code (not sure I need to but I did), and
> launched the plugin test.
>
> I create a new diagram and add a node and save (the defaults appear on
> the diagram as expected - these were setup in the ECORE file)
>
> I check the XML Data file for the diagram and the defaults are not in
> there.
>
> Is there something I can missing here,
>
> Stuart
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:eurh3g$9r0$2@build.eclipse.org...
> Stu,
>
> Like this:
>
> /**
> * Creates an instance of the resource.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated *NOT*
> */
> @Override
> public Resource createResource(URI uri)
> {
> XMLResource result = new LibraryResourceImpl(uri);
>
> *result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_ DEFAULT_CONTENT,
> Boolean.TRUE);*
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
> Boolean.TRUE);
>
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
> result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
> Boolean.TRUE);
>
>
> result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
> Boolean.TRUE);
> return result;
> }
>
>
> Stu wrote:
>> Ed,
>> Sorry mate, still struggling here with this one.
>> Maybe a code example would help.
>>
>> Im at the createResource(URI) method in the
>> <myProject>ResourceFactoryImpl but not sure what to do to include
>> this save option.
>>
>> Stu
>>
>> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote
>> in message news:eur3af$hs3$1@build.eclipse.org...
>> Stu,
>>
>> You can override the createResource method of the
>> XyzResourceFactoryImpl to include this as a default save option.
>>
>>
>> Stu wrote:
>>> Ed,
>>> Thanks for the reply. I see I have a ResourceImpl which is specific for my
>>> project but how do I use this save option you mention below?
>>>
>>> "Ed Merks" <merks@ca.ibm.com> wrote in message
>>> news:euqps3$55v$2@build.eclipse.org...
>>>
>>>> Stu,
>>>>
>>>> Features for which eIsSet returns false will not be serialized so
>>>> generally default values will not be serialized. You can use the save
>>>> option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
>>>> serialized.
>>>>
>>>>
>>>> Stu wrote:
>>>>
>>>>> Not sure if this is a bug or not.
>>>>>
>>>>> I have put a default in the ecore model for an attribute, its appears in
>>>>> the diagram ok BUT doesn't appear in the XML data output from the
>>>>> diagram.
>>>>> I'm guessing its because the attribute changed event is never generated
>>>>> so its not expected to be anything other that it's initial value.
>>>>> I would like all attibutes to appear in the XML data output from the
>>>>> diagram event if they do not have a value - is that easy to do ?
>>>>>
>>>>> Stuart
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>
>


--------------080803090008060807090202
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">
Stu,<br>
<br>
Is this resource you've overridden actual being used to save your XML
data file?&nbsp; Check when the save happens that the option is actually set
in the resource's defaultSaveOptions map.<br>
<br>
<br>
Stu wrote:
<blockquote cite="mideusgjk$9rc$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.6000.16414" name="GENERATOR">
<div><font face="Arial" size="2">Ok.</font></div>
<div><font face="Arial" size="2">I have my &lt;project&gt;ResourceImpl</font></div>
<div><font face="Arial" size="2">and it already overrides the
createResource method and create a Resource.</font></div>
<div><font face="Arial" size="2">See below:-</font></div>
<div><font size="2">
</font>
<p align="left"><font color="#3f5fbf" size="2">/**</font></p>
<font size="2"></font>
<p align="left"><font color="#3f5fbf" size="2">*</font><font size="2">
</font><font color="#3f5fbf" size="2">Creates</font><font size="2"> </font><font
color="#3f5fbf" size="2">an</font><font size="2"> </font><font
color="#3f5fbf" size="2">instance</font><font size="2"> </font><font
color="#3f5fbf" size="2">of</font><font size="2"> </font><font
color="#3f5fbf" size="2">the</font><font size="2"> </font><font
color="#3f5fbf" size="2">resource.</font></p>
<font size="2"></font>
<p align="left"><font color="#3f5fbf" size="2">*</font><font size="2">
</font><font color="#3f5fbf" size="2">&lt;!-- begin-user-doc --&gt;</font></p>
<font size="2"></font>
<p align="left"><font color="#3f5fbf" size="2">*</font><font size="2">
</font><font color="#3f5fbf" size="2">&lt;!-- end-user-doc --&gt;</font></p>
<font size="2"></font>
<p align="left"><font color="#3f5fbf" size="2">*</font><font size="2">
</font><b><font color="#7f9fbf" size="2">@generated</font></b></p>
<font size="2"></font>
<p align="left"><font color="#3f5fbf" size="2">*/</font></p>
<font size="2"></font>
<p align="left"><font color="#646464" size="2">@Override</font></p>
<font size="2"></font>
<p align="left"><b><font color="#7f0055" size="2">public</font></b><font
size="2"> Resource createResource(URI uri) {</font></p>
<p align="left"><font size="2">Resource result = </font><b><font
color="#7f0055" size="2">new</font></b><font size="2">
RulesstepbystepmodelResourceImpl(uri);</font></p>
<p align="left"><b><font color="#7f0055" size="2">return</font></b><font
size="2"> result;</font></p>
<p align="left"><font size="2">}</font></p>
<p align="left"><font size="2">I replace this with:-</font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">/**</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">*</font><font
size="2"> </font><font color="#3f5fbf" size="2">Creates</font><font
size="2"> </font><font color="#3f5fbf" size="2">an</font><font
size="2"> </font><font color="#3f5fbf" size="2">instance</font><font
size="2"> </font><font color="#3f5fbf" size="2">of</font><font
size="2"> </font><font color="#3f5fbf" size="2">the</font><font
size="2"> </font><font color="#3f5fbf" size="2">resource.</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">*</font><font
size="2"> </font><font color="#3f5fbf" size="2">&lt;!--
begin-user-doc --&gt;</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">*</font><font
size="2"> </font><font color="#3f5fbf" size="2">&lt;!-- end-user-doc
--&gt;</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">*</font><font
size="2"> </font><b><font color="#7f9fbf" size="2">@generated NOT</font></b></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#3f5fbf" size="2">*/</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><font color="#646464" size="2">@Override</font></font></p>
<font size="2"><font size="2"></font></font>
<p align="left"><font size="2"><b><font color="#7f0055" size="2">public</font></b><font
size="2"> Resource createResource(URI uri) {</font></font></p>
<p align="left"><font size="2"><font size="2">XMLResource result = </font><b><font
color="#7f0055" size="2">new</font></b><font size="2">
RulesstepbystepmodelResourceImpl(uri);</font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial"><font
face="Times New Roman">&nbsp;&nbsp;&nbsp; <b> result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CONTENT,
Boolean.TRUE);</b></font></font></font></font></p>
<p align="left"><font size="2"><b><font color="#7f0055" size="2">return</font></b><font
size="2"> result;</font></font></p>
<p align="left"><font size="2"><font size="2">}</font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial">I
regenerate the diagram code (not sure I need to but I did), and
launched the plugin test.</font></font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial">I
create a new diagram and add a node and save (the defaults appear on
the diagram as expected - these were setup in the ECORE file)</font></font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial">I
check the XML Data file for the diagram and the defaults are not in
there.</font></font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial">Is
there something I can missing here,</font></font></font></p>
<p align="left"><font size="2"><font size="2"><font face="Arial">Stuart</font></font></font></p>
</div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
wrote in message <a href="news:eurh3g$9r0$2@build.eclipse.org">news:eurh3g$9r0$2@build.eclipse.org</a>...</div>
Stu,<br>
<br>
Like this:<br>
<blockquote><small>&nbsp; /**</small><br>
<small>&nbsp;&nbsp; * Creates an instance of the resource.</small><br>
<small>&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * @generated <b>NOT</b></small><br>
<small>&nbsp;&nbsp; */</small><br>
<small>&nbsp; @Override</small><br>
<small>&nbsp; public Resource createResource(URI uri)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; XMLResource result = new LibraryResourceImpl(uri);</small><br>
<small>&nbsp;&nbsp;&nbsp; <b> result.getDefaultSaveOptions().put(XMLResource.OPTION_KEEP_D EFAULT_CONTENT,
Boolean.TRUE);</b></small><br>
<small>&nbsp;&nbsp;&nbsp; </small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTEND ED_META_DATA,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA _LOCATION,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_EN CODED_ATTRIBUTE_STYLE,
Boolean.TRUE);</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp;
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LE XICAL_HANDLER,
Boolean.TRUE);</small><br>
<small>&nbsp;&nbsp;&nbsp; return result;</small><br>
<small>&nbsp; }</small><br>
</blockquote>
<br>
Stu wrote:
<blockquote cite="mideur693$ao9$1@build.eclipse.org" type="cite">
<meta content="MSHTML 6.00.6000.16414" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Ed,</font></div>
<div><font face="Arial" size="2">Sorry mate, still struggling
here with this one.</font></div>
<div><font face="Arial" size="2">Maybe a code example would help.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Im at the createResource(URI)
method in the &lt;myProject&gt;ResourceFactoryImpl but not sure what to
do to include this save option.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Stu</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
wrote in message <a href="news:eur3af$hs3$1@build.eclipse.org">news:eur3af$hs3$1@build.eclipse.org</a>...</div>
Stu,<br>
<br>
You can override the createResource method of the
XyzResourceFactoryImpl to include this as a default save option.<br>
<br>
<br>
Stu wrote:
<blockquote cite="mideur2vb$gvf$1@build.eclipse.org" type="cite">
<pre wrap="">Ed,
Thanks for the reply. I see I have a ResourceImpl which is specific for my
project but how do I use this save option you mention below?

"Ed Merks" <a class="moz-txt-link-rfc2396E"
href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext"
href="news:euqps3$55v$2@build.eclipse.org">news:euqps3$55v$2@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Stu,

Features for which eIsSet returns false will not be serialized so
generally default values will not be serialized. You can use the save
option XMLResource.OPTION_KEEP_DEFAULT_CONTENT to force them to be
serialized.


Stu wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Not sure if this is a bug or not.

I have put a default in the ecore model for an attribute, its appears in
the diagram ok BUT doesn't appear in the XML data output from the
diagram.
I'm guessing its because the attribute changed event is never generated
so its not expected to be anything other that it's initial value.
I would like all attibutes to appear in the XML data output from the
diagram event if they do not have a value - is that easy to do ?

Stuart


</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

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

--------------080803090008060807090202--
Previous Topic:Problem with diagram creation from model file
Next Topic:How can one disable or remove a partAction ?
Goto Forum:
  


Current Time: Fri Sep 27 07:29:55 GMT 2024

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

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

Back to the top