Home » Modeling » GMF (Graphical Modeling Framework) » how do we use EIDAttribute ?
how do we use EIDAttribute ? [message #151369] |
Mon, 17 September 2007 10:11  |
Eclipse User |
|
|
|
Originally posted by: NOSPAM.xyz.com
Hi there,
I have to move Nodes between different diagram editors
and to me it seems a good idea to use their string IDs to track where they
are.
However I just noticed that
EClass eClass = eObject.eClass();
EAttribute eIDAttribute = eClass.getEIDAttribute();
returns null from my Nodes, so I can not use
eObject.eSet(eIDAttribute,
createFromString(eIDAttribute.getEAttributeType(), id));
On the other hand, the diagram XMLResource has an entry for my nodes in its
getIDToEObjectMap()
and the nodes are persisted with these IDs in XML.
Is there a way to set these IDs at run time, or I am missing them from the
very beginning in my model.
The usage pattern of EIDAttribute is way not clear to me. Any refs?
Thanks
Theo
|
|
|
Re: how do we use EIDAttribute ? [message #151377 is a reply to message #151369] |
Mon, 17 September 2007 10:16   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------090104050700050807080109
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Theo,
Maybe reading some of the previous posts on the subject will answer your
questions:
http://www.eclipse.org/search/search.cgi?q=extrinsic+intrins ic+ID&cmd=Search%21&form=extended&wf=574a74& ps=10&m=all&t=5&ul=%2Fnewslists%2Fnews.eclipse.t ools.emf&wm=wrd&t=News&t=Mail
< http://www.eclipse.org/search/search.cgi?q=extrinsic+intrins ic+ID&cmd=Search%21&form=extended&wf=574a74& ps=10&m=all&t=5&ul=%2Fnewslists%2Fnews.eclipse.t ools.emf&wm=wrd&t=News&t=Mail>
Theo wrote:
> Hi there,
> I have to move Nodes between different diagram editors
> and to me it seems a good idea to use their string IDs to track where they
> are.
> However I just noticed that
> EClass eClass = eObject.eClass();
> EAttribute eIDAttribute = eClass.getEIDAttribute();
> returns null from my Nodes, so I can not use
> eObject.eSet(eIDAttribute,
> createFromString(eIDAttribute.getEAttributeType(), id));
>
> On the other hand, the diagram XMLResource has an entry for my nodes in its
> getIDToEObjectMap()
> and the nodes are persisted with these IDs in XML.
>
> Is there a way to set these IDs at run time, or I am missing them from the
> very beginning in my model.
> The usage pattern of EIDAttribute is way not clear to me. Any refs?
> Thanks
> Theo
>
>
>
--------------090104050700050807080109
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">
Theo,<br>
<br>
Maybe reading some of the previous posts on the subject will answer
your questions:<br>
<blockquote><a
href=" http://www.eclipse.org/search/search.cgi?q=extrinsic+intrins ic+ID& ;cmd=Search%21&form=extended&wf=574a74&a mp;ps=10&m=all&t=5&ul=%2Fnewslists%2 Fnews.eclipse.tools.emf&wm=wrd&t=News&am p;t=Mail "> http://www.eclipse.org/search/search.cgi?q=extrinsic+intrins ic+ID& ;cmd=Search%21&form=extended&wf=574a74&a mp;ps=10&m=all&t=5&ul=%2Fnewslists%2 Fnews.eclipse.tools.emf&wm=wrd&t=News&am p;t=Mail </a><br>
</blockquote>
<br>
Theo wrote:
<blockquote cite="mid:fcm1uc$utd$1@build.eclipse.org" type="cite">
<pre wrap="">Hi there,
I have to move Nodes between different diagram editors
and to me it seems a good idea to use their string IDs to track where they
are.
However I just noticed that
EClass eClass = eObject.eClass();
EAttribute eIDAttribute = eClass.getEIDAttribute();
returns null from my Nodes, so I can not use
eObject.eSet(eIDAttribute,
createFromString(eIDAttribute.getEAttributeType(), id));
On the other hand, the diagram XMLResource has an entry for my nodes in its
getIDToEObjectMap()
and the nodes are persisted with these IDs in XML.
Is there a way to set these IDs at run time, or I am missing them from the
very beginning in my model.
The usage pattern of EIDAttribute is way not clear to me. Any refs?
Thanks
Theo
</pre>
</blockquote>
<br>
</body>
</html>
--------------090104050700050807080109--
|
|
|
Re: how do we use EIDAttribute ? [message #151386 is a reply to message #151369] |
Mon, 17 September 2007 10:18   |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Theo,
This is really an EMF question (hence my reply to that group).
The XMLResource can maintain a mapping of extrinsic object IDs. The
eIDAttribute is used to implement intrinsic object IDs. If your EClass has
an EAttribute (usually of type EString, I imagine) that has its isID
property set to true, then this is what the EClass returns as its
eIDAttribute. Evidently, you didn't define an ID attribute in your model.
To assign an object's extrinsic ID, you can use the
XMLResource::setID(EObject, String) method. Otherwise, the resource will
automatically compute an ID any way that it can if it is configured (as
GMFResources are) to use IDs.
Note, also, that the XMLResource implementation remembers the ID of an
object that has been detached, in case it should become re-attached to the
same or another resource. This ensures that your object will still have
the same ID when it is detached from one resource in the one diagram editor
and attached to the other resource in the other editor.
HTH,
Christian
Theo wrote:
> Hi there,
> I have to move Nodes between different diagram editors
> and to me it seems a good idea to use their string IDs to track where they
> are.
> However I just noticed that
> EClass eClass = eObject.eClass();
> EAttribute eIDAttribute = eClass.getEIDAttribute();
> returns null from my Nodes, so I can not use
> eObject.eSet(eIDAttribute,
> createFromString(eIDAttribute.getEAttributeType(), id));
>
> On the other hand, the diagram XMLResource has an entry for my nodes in
> its
> getIDToEObjectMap()
> and the nodes are persisted with these IDs in XML.
>
> Is there a way to set these IDs at run time, or I am missing them from the
> very beginning in my model.
> The usage pattern of EIDAttribute is way not clear to me. Any refs?
> Thanks
> Theo
|
|
|
Re: how do we use EIDAttribute ? [message #151878 is a reply to message #151369] |
Thu, 20 September 2007 17:52  |
Eclipse User |
|
|
|
Originally posted by: NOSPAM.xyz.com
Thank you Ed, Christian,
got it now
"Theo" <NOSPAM@xyz.com> wrote in message
news:fcm1uc$utd$1@build.eclipse.org...
> Hi there,
> I have to move Nodes between different diagram editors
> and to me it seems a good idea to use their string IDs to track where they
> are.
> However I just noticed that
> EClass eClass = eObject.eClass();
> EAttribute eIDAttribute = eClass.getEIDAttribute();
> returns null from my Nodes, so I can not use
> eObject.eSet(eIDAttribute,
> createFromString(eIDAttribute.getEAttributeType(), id));
>
> On the other hand, the diagram XMLResource has an entry for my nodes in
> its
> getIDToEObjectMap()
> and the nodes are persisted with these IDs in XML.
>
> Is there a way to set these IDs at run time, or I am missing them from the
> very beginning in my model.
> The usage pattern of EIDAttribute is way not clear to me. Any refs?
> Thanks
> Theo
>
|
|
|
Goto Forum:
Current Time: Thu Sep 18 10:10:33 EDT 2025
Powered by FUDForum. Page generated in 0.03792 seconds
|