Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » model creation wizard: how to restrict possible root elements
model creation wizard: how to restrict possible root elements [message #413814] Mon, 15 October 2007 15:14 Go to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Hi.
If I generate Ecore from XSD, and if the XSD has only a number of root
elements, being of complex types, the generated Editor wizard correctly
restricts the possible root or "Model Elements" to those being root
elements in the original XSD.

How can I most elegantly do, if I use Ecore directly?

Formulated for the Library example: how can I restrict the choices of
the "model Elements" in the generated model creation wizard to "Library"?

Do I really have to go through the XSD stuff??

I'd prefer this to changing the code manually..

Best, Philipp

PS: I know I could do the above experiment on my own, and I will
possibly. But I think the question is of general interest. Please
correct me if I am wrong.
Re: model creation wizard: how to restrict possible root elements [message #413818 is a reply to message #413814] Mon, 15 October 2007 16:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030607020709020303010807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Philipp,

The only way right now is to specialize this method in the XyzModelWizard:

protected Collection<String> getInitialObjectNames()


Philipp W. Kutter wrote:
> Hi.
> If I generate Ecore from XSD, and if the XSD has only a number of root
> elements, being of complex types, the generated Editor wizard correctly
> restricts the possible root or "Model Elements" to those being root
> elements in the original XSD.
>
> How can I most elegantly do, if I use Ecore directly?
>
> Formulated for the Library example: how can I restrict the choices of
> the "model Elements" in the generated model creation wizard to "Library"?
>
> Do I really have to go through the XSD stuff??
>
> I'd prefer this to changing the code manually..
>
> Best, Philipp
>
> PS: I know I could do the above experiment on my own, and I will
> possibly. But I think the question is of general interest. Please
> correct me if I am wrong.


--------------030607020709020303010807
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">
Philipp,<br>
<br>
The only way right now is to specialize this method in the
XyzModelWizard:<br>
<blockquote>&nbsp; protected Collection&lt;String&gt; getInitialObjectNames()<br>
</blockquote>
<br>
Philipp W. Kutter wrote:
<blockquote cite="mid:ff002f$8cr$1@build.eclipse.org" type="cite">Hi.
<br>
If I generate Ecore from XSD, and if the XSD has only a number of root
elements, being of complex types, the generated Editor wizard correctly
<br>
restricts the possible root or "Model Elements" to those being root
elements in the original XSD.
<br>
<br>
How can I most elegantly do, if I use Ecore directly?
<br>
<br>
Formulated for the Library example: how can I restrict the choices of
the "model Elements" in the generated model creation wizard to
"Library"?
<br>
<br>
Do I really have to go through the XSD stuff??
<br>
<br>
I'd prefer this to changing the code manually..
<br>
<br>
Best, Philipp
<br>
<br>
PS: I know I could do the above experiment on my own, and I will
possibly. But I think the question is of general interest. Please
<br>
correct me if I am wrong.
<br>
</blockquote>
<br>
</body>
</html>

--------------030607020709020303010807--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model creation wizard: how to restrict possible root elements [message #413821 is a reply to message #413818] Mon, 15 October 2007 16:25 Go to previous messageGo to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Thanks, perfect. That code is easy to change by hand.

In the corresponding template, I see

genPackage.hasDocumentRoot()

and then,

for EStructuralFeature eStructuralFeature :
ExtendedMetaData.INSTANCE.getAllElements(
ExtendedMetaData.INSTANCE.getDocumentRoot(
<%=genPackage.getUncapPackageInterfaceName()%>)))
....
initialObjectNames.add(eStructuralFeature.getName());
...


Would setting a document root not be what I want to do, rather than
changing

protected Collection<String> getInitialObjectNames()

as you propose, or am I completly wrong? What is a document root, and
where is it set in ECore?

Best, Philipp

Ed Merks wrote:
> Philipp,
>
> The only way right now is to specialize this method in the XyzModelWizard:
>
> protected Collection<String> getInitialObjectNames()
>
>
> Philipp W. Kutter wrote:
>> Hi.
>> If I generate Ecore from XSD, and if the XSD has only a number of root
>> elements, being of complex types, the generated Editor wizard correctly
>> restricts the possible root or "Model Elements" to those being root
>> elements in the original XSD.
>>
>> How can I most elegantly do, if I use Ecore directly?
>>
>> Formulated for the Library example: how can I restrict the choices of
>> the "model Elements" in the generated model creation wizard to "Library"?
>>
>> Do I really have to go through the XSD stuff??
>>
>> I'd prefer this to changing the code manually..
>>
>> Best, Philipp
>>
>> PS: I know I could do the above experiment on my own, and I will
>> possibly. But I think the question is of general interest. Please
>> correct me if I am wrong.
>
Re: model creation wizard: how to restrict possible root elements [message #413822 is a reply to message #413821] Mon, 15 October 2007 16:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Philipp,

A document root is quite a complex thing to specify by hand. If you
generate from a schema with global elements or attributes, then you will
have one, but to build it by hand is a lot of work and it will kind of
mess up your clean model to create one so I would not recommend doing
that as a way to solve this problem.


Philipp W. Kutter wrote:
> Thanks, perfect. That code is easy to change by hand.
>
> In the corresponding template, I see
>
> genPackage.hasDocumentRoot()
>
> and then,
>
> for EStructuralFeature eStructuralFeature :
> ExtendedMetaData.INSTANCE.getAllElements(
> ExtendedMetaData.INSTANCE.getDocumentRoot(
> <%=genPackage.getUncapPackageInterfaceName()%>)))
> ....
> initialObjectNames.add(eStructuralFeature.getName());
> ...
>
>
> Would setting a document root not be what I want to do, rather than
> changing
>
> protected Collection<String> getInitialObjectNames()
>
> as you propose, or am I completly wrong? What is a document root, and
> where is it set in ECore?
>
> Best, Philipp
>
> Ed Merks wrote:
>> Philipp,
>>
>> The only way right now is to specialize this method in the
>> XyzModelWizard:
>>
>> protected Collection<String> getInitialObjectNames()
>>
>>
>> Philipp W. Kutter wrote:
>>> Hi.
>>> If I generate Ecore from XSD, and if the XSD has only a number of
>>> root elements, being of complex types, the generated Editor wizard
>>> correctly
>>> restricts the possible root or "Model Elements" to those being root
>>> elements in the original XSD.
>>>
>>> How can I most elegantly do, if I use Ecore directly?
>>>
>>> Formulated for the Library example: how can I restrict the choices
>>> of the "model Elements" in the generated model creation wizard to
>>> "Library"?
>>>
>>> Do I really have to go through the XSD stuff??
>>>
>>> I'd prefer this to changing the code manually..
>>>
>>> Best, Philipp
>>>
>>> PS: I know I could do the above experiment on my own, and I will
>>> possibly. But I think the question is of general interest. Please
>>> correct me if I am wrong.
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model creation wizard: how to restrict possible root elements [message #414383 is a reply to message #413822] Sun, 04 November 2007 17:43 Go to previous messageGo to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Do you think it makes sense, if I enter a feature request, to define
Document Roots easily for any ECore model?

Best, Philipp

Ed Merks wrote:
> Philipp,
>
> A document root is quite a complex thing to specify by hand. If you
> generate from a schema with global elements or attributes, then you will
> have one, but to build it by hand is a lot of work and it will kind of
> mess up your clean model to create one so I would not recommend doing
> that as a way to solve this problem.
>
>
> Philipp W. Kutter wrote:
>> Thanks, perfect. That code is easy to change by hand.
>>
>> In the corresponding template, I see
>>
>> genPackage.hasDocumentRoot()
>>
>> and then,
>>
>> for EStructuralFeature eStructuralFeature :
>> ExtendedMetaData.INSTANCE.getAllElements(
>> ExtendedMetaData.INSTANCE.getDocumentRoot(
>> <%=genPackage.getUncapPackageInterfaceName()%>)))
>> ....
>> initialObjectNames.add(eStructuralFeature.getName());
>> ...
>>
>>
>> Would setting a document root not be what I want to do, rather than
>> changing
>>
>> protected Collection<String> getInitialObjectNames()
>>
>> as you propose, or am I completly wrong? What is a document root, and
>> where is it set in ECore?
>>
>> Best, Philipp
>>
>> Ed Merks wrote:
>>> Philipp,
>>>
>>> The only way right now is to specialize this method in the
>>> XyzModelWizard:
>>>
>>> protected Collection<String> getInitialObjectNames()
>>>
>>>
>>> Philipp W. Kutter wrote:
>>>> Hi.
>>>> If I generate Ecore from XSD, and if the XSD has only a number of
>>>> root elements, being of complex types, the generated Editor wizard
>>>> correctly
>>>> restricts the possible root or "Model Elements" to those being root
>>>> elements in the original XSD.
>>>>
>>>> How can I most elegantly do, if I use Ecore directly?
>>>>
>>>> Formulated for the Library example: how can I restrict the choices
>>>> of the "model Elements" in the generated model creation wizard to
>>>> "Library"?
>>>>
>>>> Do I really have to go through the XSD stuff??
>>>>
>>>> I'd prefer this to changing the code manually..
>>>>
>>>> Best, Philipp
>>>>
>>>> PS: I know I could do the above experiment on my own, and I will
>>>> possibly. But I think the question is of general interest. Please
>>>> correct me if I am wrong.
>>>
Re: model creation wizard: how to restrict possible root elements [message #414384 is a reply to message #414383] Sun, 04 November 2007 17:48 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000503020308010906050400
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Philipp,

I think it falls under this bugzilla:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=143478


Philipp W. Kutter wrote:
> Do you think it makes sense, if I enter a feature request, to define
> Document Roots easily for any ECore model?
>
> Best, Philipp
>
> Ed Merks wrote:
>> Philipp,
>>
>> A document root is quite a complex thing to specify by hand. If you
>> generate from a schema with global elements or attributes, then you
>> will have one, but to build it by hand is a lot of work and it will
>> kind of mess up your clean model to create one so I would not
>> recommend doing that as a way to solve this problem.
>>
>>
>> Philipp W. Kutter wrote:
>>> Thanks, perfect. That code is easy to change by hand.
>>>
>>> In the corresponding template, I see
>>>
>>> genPackage.hasDocumentRoot()
>>>
>>> and then,
>>>
>>> for EStructuralFeature eStructuralFeature :
>>> ExtendedMetaData.INSTANCE.getAllElements(
>>> ExtendedMetaData.INSTANCE.getDocumentRoot(
>>> <%=genPackage.getUncapPackageInterfaceName()%>)))
>>> ....
>>> initialObjectNames.add(eStructuralFeature.getName());
>>> ...
>>>
>>>
>>> Would setting a document root not be what I want to do, rather than
>>> changing
>>>
>>> protected Collection<String> getInitialObjectNames()
>>>
>>> as you propose, or am I completly wrong? What is a document root, and
>>> where is it set in ECore?
>>>
>>> Best, Philipp
>>>
>>> Ed Merks wrote:
>>>> Philipp,
>>>>
>>>> The only way right now is to specialize this method in the
>>>> XyzModelWizard:
>>>>
>>>> protected Collection<String> getInitialObjectNames()
>>>>
>>>>
>>>> Philipp W. Kutter wrote:
>>>>> Hi.
>>>>> If I generate Ecore from XSD, and if the XSD has only a number of
>>>>> root elements, being of complex types, the generated Editor wizard
>>>>> correctly
>>>>> restricts the possible root or "Model Elements" to those being
>>>>> root elements in the original XSD.
>>>>>
>>>>> How can I most elegantly do, if I use Ecore directly?
>>>>>
>>>>> Formulated for the Library example: how can I restrict the choices
>>>>> of the "model Elements" in the generated model creation wizard to
>>>>> "Library"?
>>>>>
>>>>> Do I really have to go through the XSD stuff??
>>>>>
>>>>> I'd prefer this to changing the code manually..
>>>>>
>>>>> Best, Philipp
>>>>>
>>>>> PS: I know I could do the above experiment on my own, and I will
>>>>> possibly. But I think the question is of general interest. Please
>>>>> correct me if I am wrong.
>>>>


--------------000503020308010906050400
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">
Philipp,<br>
<br>
I think it falls under this bugzilla:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=143478">https://bugs.eclipse.org/bugs/show_bug.cgi?id=143478</a><br>
</blockquote>
<br>
Philipp W. Kutter wrote:
<blockquote cite="mid:fgl0ab$afh$1@build.eclipse.org" type="cite">Do
you think it makes sense, if I enter a feature request, to define
Document Roots easily for any ECore model?
<br>
<br>
Best, Philipp
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Philipp,
<br>
<br>
A document root is quite a complex thing to specify by hand.&nbsp; If you
generate from a schema with global elements or attributes, then you
will have one, but to build it by hand is a lot of work and it will
kind of mess up your clean model to create one so I would not recommend
doing that as a way to solve this problem.
<br>
<br>
<br>
Philipp W. Kutter wrote:
<br>
<blockquote type="cite">Thanks, perfect. That code is easy to
change by hand.
<br>
<br>
In the corresponding template, I see
<br>
<br>
&nbsp; genPackage.hasDocumentRoot()
<br>
<br>
and then,
<br>
<br>
&nbsp; for EStructuralFeature eStructuralFeature :
<br>
&nbsp;&nbsp;&nbsp; ExtendedMetaData.INSTANCE.getAllElements(
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ExtendedMetaData.INSTANCE.getDocumentRoot(
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;%=genPackage.getUncapPackageInterfaceName()%&gt; )))
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ....
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; initialObjectNames.add(eStructuralFeature.getName());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ...
<br>
<br>
<br>
Would setting a document root not be what I want to do, rather than
changing
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; protected Collection&lt;String&gt; getInitialObjectNames()
<br>
<br>
as you propose, or am I completly wrong? What is a document root, and
<br>
where is it set in ECore?
<br>
<br>
Best, Philipp
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Philipp,
<br>
<br>
The only way right now is to specialize this method in the
XyzModelWizard:
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected Collection&lt;String&gt; getInitialObjectNames()
<br>
<br>
<br>
Philipp W. Kutter wrote:
<br>
<blockquote type="cite">Hi.
<br>
If I generate Ecore from XSD, and if the XSD has only a number of root
elements, being of complex types, the generated Editor wizard correctly
<br>
restricts the possible root or "Model Elements" to those being root
elements in the original XSD.
<br>
<br>
How can I most elegantly do, if I use Ecore directly?
<br>
<br>
Formulated for the Library example: how can I restrict the choices of
the "model Elements" in the generated model creation wizard to
"Library"?
<br>
<br>
Do I really have to go through the XSD stuff??
<br>
<br>
I'd prefer this to changing the code manually..
<br>
<br>
Best, Philipp
<br>
<br>
PS: I know I could do the above experiment on my own, and I will
possibly. But I think the question is of general interest. Please
<br>
correct me if I am wrong.
<br>
</blockquote>
<br>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------000503020308010906050400--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Can't convert correctly uml2 to ecore
Next Topic:How to use ecore.generator.Generator
Goto Forum:
  


Current Time: Thu Apr 25 05:08:29 GMT 2024

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

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

Back to the top