Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Enum Regression
EMF Enum Regression [message #422109] Fri, 22 August 2008 08:24 Go to next message
FrizBeber is currently offline FrizBeberFriend
Messages: 6
Registered: July 2009
Junior Member
Hi all,

I ve just moved from Eclipse 3.2 to Eclipse 3.4 and with that a new
version of emf generation and I ve got a regression for the enumeration.
Firstly I use the generation from xml (*.xsd).
So when I want to have Enumeration and I use an intermediate simple type,
the enumeration is not visible if I delete the intermediate simple type,
it works fine.

For example :
<xsd:complexType name="FamilyDiagPlugType">
<xsd:attribute name="Channel16" type="va:FamilyDiagPlugChannel16Type"
use="required"/>
<xsd:attribute name="Channel18" type="va:FamilyDiagPlugChannel18Type"
use="required"/>
<xsd:attribute name="Channel30" type="va:FamilyDiagPlugChannel30Type"
use="required"/>
<xsd:attribute name="Channel18CentralizedPlug"
type="va:FamilyDiagPlugChannel18CentralizedPlugType" use="required"/>
</xsd:complexType>
<xsd:simpleType name="FamilyDiagPlugChannel16Type">
<xsd:restriction base="va:RelaiCarteCOMType"/>
</xsd:simpleType>
<xsd:simpleType name="RelaiCarteCOMType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="00"/>
<xsd:enumeration value="02"/>
<xsd:enumeration value="04"/>
<xsd:enumeration value="06"/>
<xsd:enumeration value="07"/>
<xsd:enumeration value="08"/>
</xsd:restriction>
</xsd:simpleType>

This does not work but if I replace FamilyDiagPlugChannel16Type by
RelaiCarteCOMType in the complex type : it works fine.

I did not have that problem with the previous eclipse version.
Does Anyone know something about that ?
Maybe I need to setup a new parameter ?

Have a g'day
Bertrand
Re: EMF Enum Regression [message #422117 is a reply to message #422109] Fri, 22 August 2008 10:05 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060900030308090006030305
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Bertrand,

Comments below.


Bertrand wrote:
> Hi all,
>
> I ve just moved from Eclipse 3.2 to Eclipse 3.4 and with that a new
> version of emf generation and I ve got a regression for the
> enumeration. Firstly I use the generation from xml (*.xsd). So when I
> want to have Enumeration and I use an intermediate simple type, the
> enumeration is not visible if I delete the intermediate simple type,
> it works fine.
I'm not sure what you mean by it not being visible?
>
>
> For example :
> <xsd:complexType name="FamilyDiagPlugType">
> <xsd:attribute name="Channel16"
> type="va:FamilyDiagPlugChannel16Type" use="required"/>
> <xsd:attribute name="Channel18"
> type="va:FamilyDiagPlugChannel18Type" use="required"/>
> <xsd:attribute name="Channel30"
> type="va:FamilyDiagPlugChannel30Type" use="required"/>
> <xsd:attribute name="Channel18CentralizedPlug"
> type="va:FamilyDiagPlugChannel18CentralizedPlugType" use="required"/>
> </xsd:complexType>
> <xsd:simpleType name="FamilyDiagPlugChannel16Type">
> <xsd:restriction base="va:RelaiCarteCOMType"/>
> </xsd:simpleType>
> <xsd:simpleType name="RelaiCarteCOMType">
> <xsd:restriction base="xsd:string">
> <xsd:enumeration value="00"/>
> <xsd:enumeration value="02"/>
> <xsd:enumeration value="04"/>
> <xsd:enumeration value="06"/>
> <xsd:enumeration value="07"/>
> <xsd:enumeration value="08"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> This does not work but if I replace FamilyDiagPlugChannel16Type by
> RelaiCarteCOMType in the complex type : it works fine.
What are the symptoms of not working?
>
> I did not have that problem with the previous eclipse version.
I'm a bit confused... This example works fine:

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

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

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

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

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

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

<xsd:simpleType name="BookCategory2">
<xsd:restriction base="lib:BookCategory">
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>


Even changing it to this works:

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


> Does Anyone know something about that ? Maybe I need to setup a new
> parameter ?
I guess I need to understand what's not working? I know at one point we
started generating EEnums for cases where before we didn't. You can use
ecore:enum="false" to suppress those if you really don't want them...
>
> Have a g'day
> Bertrand
>
>

--------------060900030308090006030305
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Bertrand,<br>
<br>
Comments below.<br>
<br>
<br>
Bertrand wrote:
<blockquote
cite="mid:40dfcd70562b7dd67864a4803da76d8d$1@www.eclipse.org"
type="cite">Hi all,
<br>
<br>
I ve just moved from Eclipse 3.2 to Eclipse 3.4 and with that a new
version of emf generation and I ve got a regression for the
enumeration. Firstly I use the generation from xml (*.xsd). So when I
want to have Enumeration and I use an intermediate simple type, the
enumeration is not visible if I delete the intermediate simple type, it
works fine.</blockquote>
I'm not sure what you mean by it not being visible?<br>
<blockquote
cite="mid:40dfcd70562b7dd67864a4803da76d8d$1@www.eclipse.org"
type="cite"><br>
<br>
For example :
<br>
&lt;xsd:complexType name="FamilyDiagPlugType"&gt;
<br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Enum Regression [message #422119 is a reply to message #422117] Fri, 22 August 2008 10:10 Go to previous messageGo to next message
FrizBeber is currently offline FrizBeberFriend
Messages: 6
Registered: July 2009
Junior Member
Sorry,

Not working means : I does not have the list box for an enumeration but
only a text field classic so I don't have the list of choice ...

thanks
Re: EMF Enum Regression [message #422127 is a reply to message #422119] Fri, 22 August 2008 11:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Bertrand,

Oh, I see. Because now you have a real EEnum, as opposed to an
EDataType with enumeration constraints which it was in the past if the
values weren't all well formed Java identifiers. So if you used
ecore:enum="false" on the .xsd you'd have what you had before right?

In any case, please open a bugzilla with reference to this newsgroup
thread because we should be able to design the logic so that even if an
EDataType is not an EEnum, if it's known to be a restriction of an
EEnum, we should be able to take advantage of that; in fact, we should
be able to filter the choices so they comply with the restriction,
though in your case it was empty...

Of course you can specialize the add property descriptor method in the
item provider to specialize getChoiceOfValues to return what you want in
the meantime too...


Bertrand wrote:
> Sorry,
>
> Not working means : I does not have the list box for an enumeration
> but only a text field classic so I don't have the list of choice ...
>
> thanks
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Enum Regression [message #422134 is a reply to message #422127] Fri, 22 August 2008 11:53 Go to previous messageGo to next message
FrizBeber is currently offline FrizBeberFriend
Messages: 6
Registered: July 2009
Junior Member
Thanks for your answer but I dunno where and how to add the syntax
ecore:enum="false", I try on head of the schema or on element itself but I
get an error on validate ... Can you tell me more about that ?
Re: EMF Enum Regression [message #422137 is a reply to message #422134] Fri, 22 August 2008 12:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080902050001040102030001
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Bertrand,

You have to add the namespace declaration
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" and then

<xsd:simpleType name="RelaiCarteCOMType" ecore:enum="false">

should do the trick.


Bertrand wrote:
> Thanks for your answer but I dunno where and how to add the syntax
> ecore:enum="false", I try on head of the schema or on element itself
> but I get an error on validate ... Can you tell me more about that ?
>
>

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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Bertrand,<br>
<br>
You have to add the namespace declaration
xmlns:ecore=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a> and then<br>
<blockquote>&lt;xsd:simpleType name="RelaiCarteCOMType"
ecore:enum="false"&gt;<br>
</blockquote>
should do the trick.<br>
<br>
<br>
Bertrand wrote:
<blockquote
cite="mid:db2262cacd7223c4a75f5ba44cde78ef$1@www.eclipse.org"
type="cite">Thanks for your answer but I dunno where and how to add
the syntax ecore:enum="false", I try on head of the schema or on
element itself but I get an error on validate ... Can you tell me more
about that ?
<br>
<br>
<br>
</blockquote>
</body>
</html>

--------------080902050001040102030001--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Enum Regression [message #422140 is a reply to message #422137] Fri, 22 August 2008 13:09 Go to previous messageGo to next message
FrizBeber is currently offline FrizBeberFriend
Messages: 6
Registered: July 2009
Junior Member
I try, I ve got no problem to generate the model, edit and editor part but
my problem is still there.
The fact is that the function getFamilyDiagPlugChannel16Type returns
EDataType where before it returns a EEnum. And with your trick it does not
change anything on this part.
Any other idea ?
Otherwise, for the moment I delete the intermediate part which is not
mandaroy in my case.

Thx
Bertrand
Re: EMF Enum Regression [message #422142 is a reply to message #422140] Fri, 22 August 2008 13:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Bertrand,

Well, I've just been making assumptions based on your incomplete example
and trying to remember the history of changes from years ago. An empty
restriction is clearly pointless so if you don't needed and it causes
problems, getting rid of it seems a good approach.


Bertrand wrote:
> I try, I ve got no problem to generate the model, edit and editor part
> but my problem is still there. The fact is that the function
> getFamilyDiagPlugChannel16Type returns EDataType where before it
> returns a EEnum. And with your trick it does not change anything on
> this part.
> Any other idea ?
> Otherwise, for the moment I delete the intermediate part which is not
> mandaroy in my case.
>
> Thx
> Bertrand
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Enum Regression [message #422145 is a reply to message #422142] Fri, 22 August 2008 13:30 Go to previous message
FrizBeber is currently offline FrizBeberFriend
Messages: 6
Registered: July 2009
Junior Member
I really appreciate your help on this and through so many years, the
generation should have been moving a lot ...
I try just to understand wots happenning with this new generator and try
to help if ssomeone get the same problem. My workaround is good enough to
me
I will link this thread on a bug.
Hope this help ...
Previous Topic:Unicode character in a xmi ID
Next Topic:Dynamic EPackages / cross referencing ecore files via NS_URI
Goto Forum:
  


Current Time: Thu Sep 26 06:57:05 GMT 2024

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

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

Back to the top