Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to provide default values for required fields?
How to provide default values for required fields? [message #1066928] Fri, 05 July 2013 07:43 Go to next message
Thomas Koch is currently offline Thomas Koch
Messages: 2
Registered: July 2013
Junior Member
I've created a genmodel from an xsd file that contains boolean and integer values. When I run the generated plugin than the boolean and integer fields display "false" or "0" respectively.

However when I validate the model, than the validation fails saying that those fields have not yet been set although they display those values.

How can I specify default values for such fields or how can I make these fields not display any value at all until the user has really choosen a value?

Thank you, Thomas Koch
Re: How to provide default values for required fields? [message #1067033 is a reply to message #1066928] Fri, 05 July 2013 14:16 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26152
Registered: July 2009
Senior Member
Thomas,

Comments below.

On 05/07/2013 2:39 PM, Thomas Koch wrote:
> I've created a genmodel from an xsd file that contains boolean and
> integer values. When I run the generated plugin than the boolean and
> integer fields display "false" or "0" respectively.
>
> However when I validate the model, than the validation fails saying
> that those fields have not yet been set although they display those
> values.
Probably those features are unsettable and must be explicitly set...
>
> How can I specify default values for such fields or how can I make
> these fields not display any value at all until the user has really
> choosen a value?
The problem is they're primitives so there is always a value in Java,
and the properties view is not a very helpful API so there's no really
nice way to distinguish how it looks when there is intrinsic default
value verses a value that has been explicitly set; worse still, it
doesn't like to let you set a value equal to the string representation
that's already present. One approach would be to specialize the
property editor so that something like "<unset>" is displayed when the
feature has eIsSet false but then you have to support parsing that too...

http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_your_own_property_editor_in_a_generated_application

>
> Thank you, Thomas Koch
Previous Topic:Is there a headless feature for running MWE2 workflows?
Next Topic:Use only the editor from EMF Client Platform (ECP)
Goto Forum:
  


Current Time: Fri Oct 31 09:54:33 GMT 2014

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

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