Delete an Element [message #53231] |
Fri, 24 September 2004 23:52 |
Eclipse User |
|
|
|
Originally posted by: gj.puredge.com
Hi,
I'm deleting an Element from an Abstract schema.
Assuming that XSDElementDeclaration "element" is not global, ie: it is
declared inside some other declaration I believe all I do is remove
the particle from the model group list:
XSDElementDeclaration element;
// Get the particle for this element
XSDParticle particle = (XSDComponent)element.getContainer();
// Get model group containing the particle
XSDModelGroup group = (XSDModelGroup)particle.getContainer();
// Remove the particle
group.getContents().remove(p);
I hope I got this one right. It seems to work okay but I'm worried I have
oversimplified this and forgotten something really important. Any comments?
Thanks
|
|
|
Re: Delete an Element [message #53367 is a reply to message #53231] |
Mon, 27 September 2004 11:50 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Gary,
That should do the trick. EcoreUtil.remove will do the same thing.
Gary J wrote:
>Hi,
>
>I'm deleting an Element from an Abstract schema.
>
>Assuming that XSDElementDeclaration "element" is not global, ie: it is
>declared inside some other declaration I believe all I do is remove
>the particle from the model group list:
>
>XSDElementDeclaration element;
>
>// Get the particle for this element
>XSDParticle particle = (XSDComponent)element.getContainer();
>
>// Get model group containing the particle
>XSDModelGroup group = (XSDModelGroup)particle.getContainer();
>
>// Remove the particle
>group.getContents().remove(p);
>
>I hope I got this one right. It seems to work okay but I'm worried I have
>oversimplified this and forgotten something really important. Any comments?
>
>Thanks
>
>
>
>
|
|
|
Re: Delete an Element [message #53446 is a reply to message #53367] |
Mon, 27 September 2004 18:13 |
Eclipse User |
|
|
|
Originally posted by: gj.puredge.com
Wow! Just EcoreUtil.remove(object)? That would be very cool.
In my case I have a schema loaded into a simple tree model. I keep a
reference to the schema EObject that each tree node corresponds to:
Schema: reference to XSDSchema
Elements: reference to XSDElementDeclaration (resolved)
Attributes: reference to XSDAttributeUse
Model Groups: reference to XSDModelGroup
I just do an "instanceof" to know what kind of node I'm looking at and
display the proper icon.
Does this mean I could use EcoreUtil.remove(object) to delete each of these
from the XSD model?
XSDElementDeclaration element
EcoreUtil.remove(element);
I thought that the Particle containing the Element might get left behind.
Thanks
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:cj8uio$717$2@eclipse.org...
Gary,
That should do the trick. EcoreUtil.remove will do the same thing.
Gary J wrote:
>Hi,
>
>I'm deleting an Element from an Abstract schema.
>
>Assuming that XSDElementDeclaration "element" is not global, ie: it is
>declared inside some other declaration I believe all I do is remove
>the particle from the model group list:
>
>XSDElementDeclaration element;
>
>// Get the particle for this element
>XSDParticle particle = (XSDComponent)element.getContainer();
>
>// Get model group containing the particle
>XSDModelGroup group = (XSDModelGroup)particle.getContainer();
>
>// Remove the particle
>group.getContents().remove(p);
>
>I hope I got this one right. It seems to work okay but I'm worried I have
>oversimplified this and forgotten something really important. Any
comments?
>
>Thanks
>
>
>
>
|
|
|
Re: Delete an Element [message #53498 is a reply to message #53446] |
Mon, 27 September 2004 18:38 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------050004070004030008080504
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Gary,
EcoreUtil.remove simply breaks the parent link. It will leave the
particle or attribute use behind.
Gary J wrote:
>Wow! Just EcoreUtil.remove(object)? That would be very cool.
>
>In my case I have a schema loaded into a simple tree model. I keep a
>reference to the schema EObject that each tree node corresponds to:
>
>Schema: reference to XSDSchema
>Elements: reference to XSDElementDeclaration (resolved)
>Attributes: reference to XSDAttributeUse
>Model Groups: reference to XSDModelGroup
>
>I just do an "instanceof" to know what kind of node I'm looking at and
>display the proper icon.
>
>Does this mean I could use EcoreUtil.remove(object) to delete each of these
>from the XSD model?
>
>XSDElementDeclaration element
>
>EcoreUtil.remove(element);
>
>I thought that the Particle containing the Element might get left behind.
>
>Thanks
>
>
>
>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:cj8uio$717$2@eclipse.org...
>Gary,
>
>That should do the trick. EcoreUtil.remove will do the same thing.
>
>
>Gary J wrote:
>
>
>
>>Hi,
>>
>>I'm deleting an Element from an Abstract schema.
>>
>>Assuming that XSDElementDeclaration "element" is not global, ie: it is
>>declared inside some other declaration I believe all I do is remove
>>the particle from the model group list:
>>
>>XSDElementDeclaration element;
>>
>>// Get the particle for this element
>>XSDParticle particle = (XSDComponent)element.getContainer();
>>
>>// Get model group containing the particle
>>XSDModelGroup group = (XSDModelGroup)particle.getContainer();
>>
>>// Remove the particle
>>group.getContents().remove(p);
>>
>>I hope I got this one right. It seems to work okay but I'm worried I have
>>oversimplified this and forgotten something really important. Any
>>
>>
>comments?
>
>
>>Thanks
>>
>>
>>
>>
>>
>>
>
>
>
>
--------------050004070004030008080504
Content-Type: text/html; charset=us-ascii
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>
EcoreUtil.remove simply breaks the parent link. It will leave the
particle or attribute use behind. <br>
<br>
<br>
Gary J wrote:
<blockquote cite="midcj9kvl$n9v$1@eclipse.org" type="cite">
<pre wrap="">Wow! Just EcoreUtil.remove(object)? That would be very cool.
In my case I have a schema loaded into a simple tree model. I keep a
reference to the schema EObject that each tree node corresponds to:
Schema: reference to XSDSchema
Elements: reference to XSDElementDeclaration (resolved)
Attributes: reference to XSDAttributeUse
Model Groups: reference to XSDModelGroup
I just do an "instanceof" to know what kind of node I'm looking at and
display the proper icon.
Does this mean I could use EcoreUtil.remove(object) to delete each of these
from the XSD model?
XSDElementDeclaration element
EcoreUtil.remove(element);
I thought that the Particle containing the Element might get left behind.
Thanks
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:cj8uio$717$2@eclipse.org">news:cj8uio$717$2@eclipse.org</a>...
Gary,
That should do the trick. EcoreUtil.remove will do the same thing.
Gary J wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I'm deleting an Element from an Abstract schema.
Assuming that XSDElementDeclaration "element" is not global, ie: it is
declared inside some other declaration I believe all I do is remove
the particle from the model group list:
XSDElementDeclaration element;
// Get the particle for this element
XSDParticle particle = (XSDComponent)element.getContainer();
// Get model group containing the particle
XSDModelGroup group = (XSDModelGroup)particle.getContainer();
// Remove the particle
group.getContents().remove(p);
I hope I got this one right. It seems to work okay but I'm worried I have
oversimplified this and forgotten something really important. Any
</pre>
</blockquote>
<pre wrap=""><!---->comments?
</pre>
<blockquote type="cite">
<pre wrap="">Thanks
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------050004070004030008080504--
|
|
|
Re: Delete an Element [message #591737 is a reply to message #53231] |
Mon, 27 September 2004 11:50 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
Gary,
That should do the trick. EcoreUtil.remove will do the same thing.
Gary J wrote:
>Hi,
>
>I'm deleting an Element from an Abstract schema.
>
>Assuming that XSDElementDeclaration "element" is not global, ie: it is
>declared inside some other declaration I believe all I do is remove
>the particle from the model group list:
>
>XSDElementDeclaration element;
>
>// Get the particle for this element
>XSDParticle particle = (XSDComponent)element.getContainer();
>
>// Get model group containing the particle
>XSDModelGroup group = (XSDModelGroup)particle.getContainer();
>
>// Remove the particle
>group.getContents().remove(p);
>
>I hope I got this one right. It seems to work okay but I'm worried I have
>oversimplified this and forgotten something really important. Any comments?
>
>Thanks
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Delete an Element [message #591824 is a reply to message #53446] |
Mon, 27 September 2004 18:38 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------050004070004030008080504
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Gary,
EcoreUtil.remove simply breaks the parent link. It will leave the
particle or attribute use behind.
Gary J wrote:
>Wow! Just EcoreUtil.remove(object)? That would be very cool.
>
>In my case I have a schema loaded into a simple tree model. I keep a
>reference to the schema EObject that each tree node corresponds to:
>
>Schema: reference to XSDSchema
>Elements: reference to XSDElementDeclaration (resolved)
>Attributes: reference to XSDAttributeUse
>Model Groups: reference to XSDModelGroup
>
>I just do an "instanceof" to know what kind of node I'm looking at and
>display the proper icon.
>
>Does this mean I could use EcoreUtil.remove(object) to delete each of these
>from the XSD model?
>
>XSDElementDeclaration element
>
>EcoreUtil.remove(element);
>
>I thought that the Particle containing the Element might get left behind.
>
>Thanks
>
>
>
>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:cj8uio$717$2@eclipse.org...
>Gary,
>
>That should do the trick. EcoreUtil.remove will do the same thing.
>
>
>Gary J wrote:
>
>
>
>>Hi,
>>
>>I'm deleting an Element from an Abstract schema.
>>
>>Assuming that XSDElementDeclaration "element" is not global, ie: it is
>>declared inside some other declaration I believe all I do is remove
>>the particle from the model group list:
>>
>>XSDElementDeclaration element;
>>
>>// Get the particle for this element
>>XSDParticle particle = (XSDComponent)element.getContainer();
>>
>>// Get model group containing the particle
>>XSDModelGroup group = (XSDModelGroup)particle.getContainer();
>>
>>// Remove the particle
>>group.getContents().remove(p);
>>
>>I hope I got this one right. It seems to work okay but I'm worried I have
>>oversimplified this and forgotten something really important. Any
>>
>>
>comments?
>
>
>>Thanks
>>
>>
>>
>>
>>
>>
>
>
>
>
--------------050004070004030008080504
Content-Type: text/html; charset=us-ascii
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>
EcoreUtil.remove simply breaks the parent link. It will leave the
particle or attribute use behind. <br>
<br>
<br>
Gary J wrote:
<blockquote cite="midcj9kvl$n9v$1@eclipse.org" type="cite">
<pre wrap="">Wow! Just EcoreUtil.remove(object)? That would be very cool.
In my case I have a schema loaded into a simple tree model. I keep a
reference to the schema EObject that each tree node corresponds to:
Schema: reference to XSDSchema
Elements: reference to XSDElementDeclaration (resolved)
Attributes: reference to XSDAttributeUse
Model Groups: reference to XSDModelGroup
I just do an "instanceof" to know what kind of node I'm looking at and
display the proper icon.
Does this mean I could use EcoreUtil.remove(object) to delete each of these
from the XSD model?
XSDElementDeclaration element
EcoreUtil.remove(element);
I thought that the Particle containing the Element might get left behind.
Thanks
"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com"><merks@ca.ibm.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:cj8uio$717$2@eclipse.org">news:cj8uio$717$2@eclipse.org</a>...
Gary,
That should do the trick. EcoreUtil.remove will do the same thing.
Gary J wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I'm deleting an Element from an Abstract schema.
Assuming that XSDElementDeclaration "element" is not global, ie: it is
declared inside some other declaration I believe all I do is remove
the particle from the model group list:
XSDElementDeclaration element;
// Get the particle for this element
XSDParticle particle = (XSDComponent)element.getContainer();
// Get model group containing the particle
XSDModelGroup group = (XSDModelGroup)particle.getContainer();
// Remove the particle
group.getContents().remove(p);
I hope I got this one right. It seems to work okay but I'm worried I have
oversimplified this and forgotten something really important. Any
</pre>
</blockquote>
<pre wrap=""><!---->comments?
</pre>
<blockquote type="cite">
<pre wrap="">Thanks
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>
--------------050004070004030008080504--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03256 seconds