Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Features sorted in Ecore
Features sorted in Ecore [message #419870] Tue, 10 June 2008 12:21 Go to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
Hi,

When generating from a schema the features (types and elements) are sorted
alphabetically in the Ecore. Is it possible to control this so that the
order of Classes and their attributes is the same as the order in which they
are defined in the schema?

This does not really hinder any operations just that if the XML file saved
is to be viewed by a user then readability could be improved if more
commonly used or required attributes (such as 'name') appear before other
attributes.

Waqas
Re: Features sorted in Ecore [message #419871 is a reply to message #419870] Tue, 10 June 2008 12:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060608000909030109050206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Waqas,

XSDEcoreBuilder has support for it:

protected boolean useSortedAttributes()
{
return true;
}

protected List<XSDAttributeUse>
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
if (useSortedAttributes())
{
return xsdComplexTypeDefinition.getAttributeUses();
}
else
{
List<XSDAttributeUse> result = new
ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses());
reorderAttributeUses(result,
xsdComplexTypeDefinition.getAttributeContents());
return result;
}
}

But there's no support for setting the option in the UI


Waqas Ilyas wrote:
> Hi,
>
> When generating from a schema the features (types and elements) are sorted
> alphabetically in the Ecore. Is it possible to control this so that the
> order of Classes and their attributes is the same as the order in which they
> are defined in the schema?
>
> This does not really hinder any operations just that if the XML file saved
> is to be viewed by a user then readability could be improved if more
> commonly used or required attributes (such as 'name') appear before other
> attributes.
>
> Waqas
>
>
>


--------------060608000909030109050206
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">
Waqas,<br>
<br>
XSDEcoreBuilder has support for it:<br>
<blockquote><small>&nbsp; protected boolean useSortedAttributes()</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; return true;</small><br>
<small>&nbsp; }</small><br>
<br>
<small>&nbsp; protected List&lt;XSDAttributeUse&gt;
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; if (useSortedAttributes())</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return xsdComplexTypeDefinition.getAttributeUses();</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;XSDAttributeUse&gt; result = new
ArrayList&lt;XSDAttributeUse&gt;(xsdComplexTypeDefin ition.getAttributeUses()); </small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reorderAttributeUses(result,
xsdComplexTypeDefinition.getAttributeContents());</small><br >
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; }</small><br>
</blockquote>
But there's no support for setting the option in the UI<br>
<br>
<br>
Waqas Ilyas wrote:
<blockquote cite="mid:g2lrjj$7vm$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,

When generating from a schema the features (types and elements) are sorted
alphabetically in the Ecore. Is it possible to control this so that the
order of Classes and their attributes is the same as the order in which they
are defined in the schema?

This does not really hinder any operations just that if the XML file saved
is to be viewed by a user then readability could be improved if more
commonly used or required attributes (such as 'name') appear before other
attributes.

Waqas


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

--------------060608000909030109050206--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Features sorted in Ecore [message #419889 is a reply to message #419871] Wed, 11 June 2008 11:45 Go to previous messageGo to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0011_01C8CBEA.EE0B4180
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

It would be nice to have that option in the UI too. Should I add a =
feature request for this if it is feasible?

Waqas
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:g2lrtg$8gr$1@build.eclipse.org...
Waqas,

XSDEcoreBuilder has support for it:

protected boolean useSortedAttributes()
{
return true;
}

protected List<XSDAttributeUse> =
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
if (useSortedAttributes())
{
return xsdComplexTypeDefinition.getAttributeUses();
}
else
{
List<XSDAttributeUse> result =3D new =
ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses());
reorderAttributeUses(result, =
xsdComplexTypeDefinition.getAttributeContents());
return result;
}
}

But there's no support for setting the option in the UI


Waqas Ilyas wrote:=20
Hi,

When generating from a schema the features (types and elements) are =
sorted=20
alphabetically in the Ecore. Is it possible to control this so that the=20
order of Classes and their attributes is the same as the order in which =
they=20
are defined in the schema?

This does not really hinder any operations just that if the XML file =
saved=20
is to be viewed by a user then readability could be improved if more=20
commonly used or required attributes (such as 'name') appear before =
other=20
attributes.

Waqas=20


=20

------=_NextPart_000_0011_01C8CBEA.EE0B4180
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.2900.3314" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV>Hi Ed,</DIV>
<DIV>&nbsp;</DIV>
<DIV>It would be nice to have that option in the UI too. Should I add a =
feature=20
request for this if it is feasible?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Waqas</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:g2lrtg$8gr$1@build.eclipse.org">news:g2lrtg$8gr$1@build.ecli=
pse.org</A>...</DIV>Waqas,<BR><BR>XSDEcoreBuilder=20
has support for it:<BR>
<BLOCKQUOTE><SMALL>&nbsp; protected boolean=20
useSortedAttributes()</SMALL><BR><SMALL>&nbsp;=20
{</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp; return =
true;</SMALL><BR><SMALL>&nbsp;=20
}</SMALL><BR><BR><SMALL>&nbsp; protected List&lt;XSDAttributeUse&gt; =

getAttributeUses(XSDComplexTypeDefinition=20
xsdComplexTypeDefinition)</SMALL><BR><SMALL>&nbsp;=20
{</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp; if=20
(useSortedAttributes())</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
{</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return=20
=
xsdComplexTypeDefinition.getAttributeUses();</SMALL><BR><SMALL >&nbsp;&nbs=
p;&nbsp;=20
}</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
else</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
{</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
List&lt;XSDAttributeUse&gt; result =3D new=20
=
ArrayList&lt;XSDAttributeUse&gt;(xsdComplexTypeDefin ition.getAttributeUse=
s());</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
reorderAttributeUses(result,=20
=
xsdComplexTypeDefinition.getAttributeContents());</SMALL><BR ><SMALL>&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
return result;</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
}</SMALL><BR><SMALL>&nbsp; }</SMALL><BR></BLOCKQUOTE>But there's no =
support=20
for setting the option in the UI<BR><BR><BR>Waqas Ilyas wrote:=20
<BLOCKQUOTE cite=3Dmid:g2lrjj$7vm$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi,

When generating from a schema the features (types and elements) are =
sorted=20
alphabetically in the Ecore. Is it possible to control this so that the=20
order of Classes and their attributes is the same as the order in which =
they=20
are defined in the schema?

This does not really hinder any operations just that if the XML file =
saved=20
is to be viewed by a user then readability could be improved if more=20
commonly used or required attributes (such as 'name') appear before =
other=20
attributes.

Waqas=20


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

------=_NextPart_000_0011_01C8CBEA.EE0B4180--
Re: Features sorted in Ecore [message #419890 is a reply to message #419889] Wed, 11 June 2008 11:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080907040206090304050602
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Waqas,

Yes, it's a very reasonable feature request, especially considering that
it is effectively just some UI for existing capabilities.


Waqas Ilyas wrote:
> Hi Ed,
>
> It would be nice to have that option in the UI too. Should I add a
> feature request for this if it is feasible?
>
> Waqas
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:g2lrtg$8gr$1@build.eclipse.org...
> Waqas,
>
> XSDEcoreBuilder has support for it:
>
> protected boolean useSortedAttributes()
> {
> return true;
> }
>
> protected List<XSDAttributeUse>
> getAttributeUses(XSDComplexTypeDefinition
> xsdComplexTypeDefinition)
> {
> if (useSortedAttributes())
> {
> return xsdComplexTypeDefinition.getAttributeUses();
> }
> else
> {
> List<XSDAttributeUse> result = new
> ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses());
> reorderAttributeUses(result,
> xsdComplexTypeDefinition.getAttributeContents());
> return result;
> }
> }
>
> But there's no support for setting the option in the UI
>
>
> Waqas Ilyas wrote:
>> Hi,
>>
>> When generating from a schema the features (types and elements) are sorted
>> alphabetically in the Ecore. Is it possible to control this so that the
>> order of Classes and their attributes is the same as the order in which they
>> are defined in the schema?
>>
>> This does not really hinder any operations just that if the XML file saved
>> is to be viewed by a user then readability could be improved if more
>> commonly used or required attributes (such as 'name') appear before other
>> attributes.
>>
>> Waqas
>>
>>
>>
>


--------------080907040206090304050602
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">
Waqas,<br>
<br>
Yes, it's a very reasonable feature request, especially considering
that it is effectively just some UI for existing capabilities.<br>
<br>
<br>
Waqas Ilyas wrote:
<blockquote cite="mid:g2odsn$urc$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2900.3314" name="GENERATOR">
<style></style>
<div>Hi Ed,</div>
<div>&nbsp;</div>
<div>It would be nice to have that option in the UI too. Should I add
a feature request for this if it is feasible?</div>
<div>&nbsp;</div>
<div>Waqas</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 moz-do-not-send="true"
href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt; wrote in
message <a moz-do-not-send="true"
href="news:g2lrtg$8gr$1@build.eclipse.org">news:g2lrtg$8gr$1@build.eclipse.org</a>...</div>
Waqas,<br>
<br>
XSDEcoreBuilder has support for it:<br>
<blockquote><small>&nbsp; protected boolean useSortedAttributes()</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; return true;</small><br>
<small>&nbsp; }</small><br>
<br>
<small>&nbsp; protected List&lt;XSDAttributeUse&gt;
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; if (useSortedAttributes())</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return xsdComplexTypeDefinition.getAttributeUses();</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp;&nbsp;&nbsp; else</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;XSDAttributeUse&gt; result = new
ArrayList&lt;XSDAttributeUse&gt;(xsdComplexTypeDefin ition.getAttributeUses()); </small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reorderAttributeUses(result,
xsdComplexTypeDefinition.getAttributeContents());</small><br >
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return result;</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; }</small><br>
</blockquote>
But there's no support for setting the option in the UI<br>
<br>
<br>
Waqas Ilyas wrote:
<blockquote cite="mid:g2lrjj$7vm$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,

When generating from a schema the features (types and elements) are sorted
alphabetically in the Ecore. Is it possible to control this so that the
order of Classes and their attributes is the same as the order in which they
are defined in the schema?

This does not really hinder any operations just that if the XML file saved
is to be viewed by a user then readability could be improved if more
commonly used or required attributes (such as 'name') appear before other
attributes.

Waqas


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

--------------080907040206090304050602--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Working autosave for emf models
Next Topic:Transactional Plugins dependencies on core.resources plugin is a pain
Goto Forum:
  


Current Time: Tue Apr 23 06:53:29 GMT 2024

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

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

Back to the top