Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore Attributes
Ecore Attributes [message #422262] Wed, 27 August 2008 16:28 Go to next message
Gary Leask is currently offline Gary LeaskFriend
Messages: 28
Registered: July 2009
Junior Member
I have defined an Attribute in the Ecore and given it a Default Value
Literal. When I create a document that uses the attribute the value is
not serialized. How can I define an unchangeable default value in the
model and have it serialized to the document.

Thanks Gary
Re: Ecore Attributes [message #422264 is a reply to message #422262] Wed, 27 August 2008 17:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000704090804010309020607
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Gary,

Comments below.

Gary Leask wrote:
> I have defined an Attribute in the Ecore and given it a Default Value
> Literal. When I create a document that uses the attribute the value is
> not serialized.
Yes, when eIsSet is false for a feature it won't be serialized. But you
can use this option to alter that behavior:

OPTION_KEEP_DEFAULT_CONTENT


> How can I define an unchangeable default value in the model
I'm not sure what you mean by unchangeable. If you serialize it, I
assume you expect it to be read in again and hence for it to be
changeable...
> and have it serialized to the document.
>
> Thanks Gary

--------------000704090804010309020607
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">
Gary,<br>
<br>
Comments below.<br>
<br>
Gary Leask wrote:
<blockquote cite="mid:g93vcq$11d$1@build.eclipse.org" type="cite">I
have defined an Attribute in the Ecore and given it a Default Value
Literal. When I create a document that uses the attribute the value is
not serialized. </blockquote>
Yes, when eIsSet is false for a feature it won't be serialized. But you
can use this option to alter that behavior:<br>
<blockquote>OPTION_KEEP_DEFAULT_CONTENT<br>
</blockquote>
<br>
<blockquote cite="mid:g93vcq$11d$1@build.eclipse.org" type="cite">How
can I define an unchangeable default value in the model</blockquote>
I'm not sure what you mean by unchangeable.&nbsp; If you serialize it, I
assume you expect it to be read in again and hence for it to be
changeable...<br>
<blockquote cite="mid:g93vcq$11d$1@build.eclipse.org" type="cite">and
have it serialized to the document.
<br>
<br>
Thanks Gary
<br>
</blockquote>
</body>
</html>

--------------000704090804010309020607--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore Attributes [message #422265 is a reply to message #422264] Wed, 27 August 2008 18:57 Go to previous messageGo to next message
Gary Leask is currently offline Gary LeaskFriend
Messages: 28
Registered: July 2009
Junior Member
Ed,

Sorry but,

Where is OPTION_KEEP_DEFAULT_CONTENT defined and where do I put it in my
code to alter the default behavior.

Gary

Ed Merks wrote:
> Gary,
>
> Comments below.
>
> Gary Leask wrote:
>> I have defined an Attribute in the Ecore and given it a Default Value
>> Literal. When I create a document that uses the attribute the value is
>> not serialized.
> Yes, when eIsSet is false for a feature it won't be serialized. But you
> can use this option to alter that behavior:
>
> OPTION_KEEP_DEFAULT_CONTENT
>
>
>> How can I define an unchangeable default value in the model
> I'm not sure what you mean by unchangeable. If you serialize it, I
> assume you expect it to be read in again and hence for it to be
> changeable...
>> and have it serialized to the document.
>>
>> Thanks Gary
Re: Ecore Attributes [message #422266 is a reply to message #422265] Wed, 27 August 2008 19:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030101070807030302090607
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Gary,

XMLResource.OPTION_KEEP_DEFAULT_CONTENT. You'd set it as a save option
in your resource factory. Newsgroup search is quite handy for finding
previous answers to questions like this:
< http://www.eclipse.org/newsportal/thread.php?group=eclipse.t ools.emf>

http://www.eclipse.org/newsportal/thread.php?group=eclipse.t ools.emf


Gary Leask wrote:
> Ed,
>
> Sorry but,
>
> Where is OPTION_KEEP_DEFAULT_CONTENT defined and where do I put it in
> my code to alter the default behavior.
>
> Gary
>
> Ed Merks wrote:
>> Gary,
>>
>> Comments below.
>>
>> Gary Leask wrote:
>>> I have defined an Attribute in the Ecore and given it a Default
>>> Value Literal. When I create a document that uses the attribute the
>>> value is not serialized.
>> Yes, when eIsSet is false for a feature it won't be serialized. But
>> you can use this option to alter that behavior:
>>
>> OPTION_KEEP_DEFAULT_CONTENT
>>
>>
>>> How can I define an unchangeable default value in the model
>> I'm not sure what you mean by unchangeable. If you serialize it, I
>> assume you expect it to be read in again and hence for it to be
>> changeable...
>>> and have it serialized to the document.
>>>
>>> Thanks Gary

--------------030101070807030302090607
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">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Gary,<br>
<br>
XMLResource.OPTION_KEEP_DEFAULT_CONTENT.&nbsp; You'd set it as a save option
in your resource factory.&nbsp; Newsgroup search is quite handy for finding
previous answers to questions like this:<a
href=" http://www.eclipse.org/newsportal/thread.php?group=eclipse.t ools.emf"><br>
</a>
<blockquote><a
href=" http://www.eclipse.org/newsportal/thread.php?group=eclipse.t ools.emf"> http://www.eclipse.org/newsportal/thread.php?group=eclipse.t ools.emf</a><br>
</blockquote>
<br>
Gary Leask wrote:
<blockquote cite="mid:g9482t$sjh$1@build.eclipse.org" type="cite">Ed,
<br>
<br>
Sorry but,
<br>
<br>
Where is OPTION_KEEP_DEFAULT_CONTENT defined and where do I put it in
my code to alter the default behavior.
<br>
<br>
Gary
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Gary,
<br>
<br>
Comments below.
<br>
<br>
Gary Leask wrote:
<br>
<blockquote type="cite">I have defined an Attribute in the Ecore
and given it a Default Value Literal. When I create a document that
uses the attribute the value is not serialized. </blockquote>
Yes, when eIsSet is false for a feature it won't be serialized. But you
can use this option to alter that behavior:
<br>
<br>
&nbsp;&nbsp;&nbsp; OPTION_KEEP_DEFAULT_CONTENT
<br>
<br>
<br>
<blockquote type="cite">How can I define an unchangeable default
value in the model
<br>
</blockquote>
I'm not sure what you mean by unchangeable.&nbsp; If you serialize it, I
assume you expect it to be read in again and hence for it to be
changeable...
<br>
<blockquote type="cite">and have it serialized to the document.
<br>
<br>
Thanks Gary
<br>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>

--------------030101070807030302090607--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XML including XSD elements problem
Next Topic:[CDO] How to query model elements?
Goto Forum:
  


Current Time: Mon Sep 23 21:31:01 GMT 2024

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

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

Back to the top