Generate automatically an identifier for a node [message #147061] |
Mon, 20 August 2007 04:24  |
Eclipse User |
|
|
|
Hi.
It's me. Again...
I would like to generate an identifier for a node in my diagram.
I know there are lot of ways to do it programmatically, but I would like
to know if GMF (or EMF) can manage this automatically.
In the ecore file (and in the genmodel), there is for each attribute an
"id property". With other associated properties. Does anybody know if
this will generate an ID (whatever it looks like) or if it's just going
to validate ID properties ?
Regards,
Vincent.
|
|
|
|
Re: Generate automatically an identifier for a node [message #147148 is a reply to message #147093] |
Mon, 20 August 2007 12:11   |
Eclipse User |
|
|
|
<!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">
Hello ED. <br>
<br>
Thank you for your reply.<br>
Can you tell me where I have to define this XMIResourceImpl ?<br>
<br>
I have read something about overriding this class and creating an
associated factory. And then, I would just have to plug the thing in my
plugin.xml, as explained <a href="http://serdom.szn.pl/ser/?p=6">here</a>.
<br>
<br>
I have defined these classes in my *diagram plugin. And in the
plugin.xml, I have then added an extension but it doesn't generate any
UUID.<br>
<br>
<extension point="org.eclipse.emf.ecore.extension_parser"><br >
<parser<br>
type="gnmsmodel"<br>
class=" org.eclipse.ebmwebsourcing.orchestration.resource.Orchestrat ionResourceFactory "><br>
</parser><br>
</extension><br>
<br>
<br>
I have then set
" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y " instead
of my "OrchestrationResourceFactory", but it's still not working. Do
you have any hint to help me ?<br>
<br>
<br>
Vincent.<br>
<br>
<br>
<br>
Ed Merks wrote:
<blockquote cite="midfabsed$bu3$1@build.eclipse.org" type="cite">Vincent,
<br>
<br>
If you use an XMIResourceImpl for which you specialized useUUIDs to
return true then that the resource will generate a UUID
(EcoreUtil.generateUUID) for each object attached to that resource.
An EAttribute with isID true will just validate that this attribute's
string value is unique for all objects within the same resource, but
you could use it to store a generated UUID and you could specialize the
getter to generate a UUID if no ID has been set. <br>
<br>
<br>
Vincent Zurczak wrote: <br>
<blockquote type="cite">Hi. <br>
<br>
It's me. Again... <br>
I would like to generate an identifier for a node in my diagram. <br>
I know there are lot of ways to do it programmatically, but I would
like to know if GMF (or EMF) can manage this automatically. <br>
<br>
In the ecore file (and in the genmodel), there is for each attribute an
"id property". With other associated properties. Does anybody know if
this will generate an ID (whatever it looks like) or if it's just going
to validate ID properties ? <br>
<br>
Regards, <br>
<br>
Vincent. <br>
</blockquote>
</blockquote>
<br>
<br>
</body>
</html>
|
|
|
Re: Generate automatically an identifier for a node [message #147157 is a reply to message #147148] |
Mon, 20 August 2007 12:38   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------080707030208020708080707
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Vincent,
What you show should do the trick. Does the file you are saving end
with ".gnmsmodel"? When you save the resource, can you tell that your
derived resource impl is being used? I know that GMFResource already is
implemented to generated UUIDs, so I'm not sure why that's not already
sufficient.
Vincent Zurczak wrote:
> Hello ED.
>
> Thank you for your reply.
> Can you tell me where I have to define this XMIResourceImpl ?
>
> I have read something about overriding this class and creating an
> associated factory. And then, I would just have to plug the thing in
> my plugin.xml, as explained here <http://serdom.szn.pl/ser/?p=6>.
>
> I have defined these classes in my *diagram plugin. And in the
> plugin.xml, I have then added an extension but it doesn't generate any
> UUID.
>
> <extension point="org.eclipse.emf.ecore.extension_parser">
> <parser
> type="gnmsmodel"
>
> class=" org.eclipse.ebmwebsourcing.orchestration.resource.Orchestrat ionResourceFactory ">
> </parser>
> </extension>
>
>
> I have then set
> " org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y "
> instead of my "OrchestrationResourceFactory", but it's still not
> working. Do you have any hint to help me ?
>
>
> Vincent.
>
>
>
> Ed Merks wrote:
>> Vincent,
>>
>> If you use an XMIResourceImpl for which you specialized useUUIDs to
>> return true then that the resource will generate a UUID
>> (EcoreUtil.generateUUID) for each object attached to that resource.
>> An EAttribute with isID true will just validate that this attribute's
>> string value is unique for all objects within the same resource, but
>> you could use it to store a generated UUID and you could specialize
>> the getter to generate a UUID if no ID has been set.
>>
>>
>> Vincent Zurczak wrote:
>>> Hi.
>>>
>>> It's me. Again...
>>> I would like to generate an identifier for a node in my diagram.
>>> I know there are lot of ways to do it programmatically, but I would
>>> like to know if GMF (or EMF) can manage this automatically.
>>>
>>> In the ecore file (and in the genmodel), there is for each attribute
>>> an "id property". With other associated properties. Does anybody
>>> know if this will generate an ID (whatever it looks like) or if it's
>>> just going to validate ID properties ?
>>>
>>> Regards,
>>>
>>> Vincent.
>
>
--------------080707030208020708080707
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">
Vincent,<br>
<br>
What you show should do the trick. Does the file you are saving end
with ".gnmsmodel"? When you save the resource, can you tell that your
derived resource impl is being used? I know that GMFResource already
is implemented to generated UUIDs, so I'm not sure why that's not
already sufficient.<br>
<br>
<br>
Vincent Zurczak wrote:
<blockquote cite="mid:facefb$sc6$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
Hello ED. <br>
<br>
Thank you for your reply.<br>
Can you tell me where I have to define this XMIResourceImpl ?<br>
<br>
I have read something about overriding this class and creating an
associated factory. And then, I would just have to plug the thing in my
plugin.xml, as explained <a moz-do-not-send="true"
href="http://serdom.szn.pl/ser/?p=6">here</a>.
<br>
<br>
I have defined these classes in my *diagram plugin. And in the
plugin.xml, I have then added an extension but it doesn't generate any
UUID.<br>
<br>
<extension point="org.eclipse.emf.ecore.extension_parser"><br >
<parser<br>
type="gnmsmodel"<br>
class=" org.eclipse.ebmwebsourcing.orchestration.resource.Orchestrat ionResourceFactory "><br>
</parser><br>
</extension><br>
<br>
<br>
I have then set
" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y " instead
of my "OrchestrationResourceFactory", but it's still not working. Do
you have any hint to help me ?<br>
<br>
<br>
Vincent.<br>
<br>
<br>
<br>
Ed Merks wrote:
<blockquote cite="midfabsed$bu3$1@build.eclipse.org" type="cite">Vincent,
<br>
<br>
If you use an XMIResourceImpl for which you specialized useUUIDs to
return true then that the resource will generate a UUID
(EcoreUtil.generateUUID) for each object attached to that resource.
An EAttribute with isID true will just validate that this attribute's
string value is unique for all objects within the same resource, but
you could use it to store a generated UUID and you could specialize the
getter to generate a UUID if no ID has been set. <br>
<br>
<br>
Vincent Zurczak wrote: <br>
<blockquote type="cite">Hi. <br>
<br>
It's me. Again... <br>
I would like to generate an identifier for a node in my diagram. <br>
I know there are lot of ways to do it programmatically, but I would
like to know if GMF (or EMF) can manage this automatically. <br>
<br>
In the ecore file (and in the genmodel), there is for each attribute an
"id property". With other associated properties. Does anybody know if
this will generate an ID (whatever it looks like) or if it's just going
to validate ID properties ? <br>
<br>
Regards, <br>
<br>
Vincent. <br>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
<br>
</body>
</html>
--------------080707030208020708080707--
|
|
|
Re: Generate automatically an identifier for a node [message #147256 is a reply to message #147157] |
Tue, 21 August 2007 07:05  |
Eclipse User |
|
|
|
<!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">
Hello Ed.<br>
<br>
You were right, I just forgot to set my model extension. I replaced
"gnsmodel" by the extension of my model.<br>
Thank you very much for your help. :)<br>
<br>
Bye,<br>
<br>
Vincent.<br>
<br>
<br>
<br>
Ed Merks wrote:
<blockquote cite="midfacg2a$j7$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
Vincent,<br>
<br>
What you show should do the trick. Does the file you are saving end
with ".gnmsmodel"? When you save the resource, can you tell that your
derived resource impl is being used? I know that GMFResource already
is implemented to generated UUIDs, so I'm not sure why that's not
already sufficient.<br>
<br>
<br>
Vincent Zurczak wrote:
<blockquote cite="mid:facefb$sc6$1@build.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
Hello ED. <br>
<br>
Thank you for your reply.<br>
Can you tell me where I have to define this XMIResourceImpl ?<br>
<br>
I have read something about overriding this class and creating an
associated factory. And then, I would just have to plug the thing in my
plugin.xml, as explained <a moz-do-not-send="true"
href="http://serdom.szn.pl/ser/?p=6">here</a>. <br>
<br>
I have defined these classes in my *diagram plugin. And in the
plugin.xml, I have then added an extension but it doesn't generate any
UUID.<br>
<br>
<extension point="org.eclipse.emf.ecore.extension_parser"><br >
<parser<br>
type="gnmsmodel"<br>
class=" org.eclipse.ebmwebsourcing.orchestration.resource.Orchestrat ionResourceFactory "><br>
</parser><br>
</extension><br>
<br>
<br>
I have then set
" org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactor y " instead
of my "OrchestrationResourceFactory", but it's still not working. Do
you have any hint to help me ?<br>
<br>
<br>
Vincent.<br>
</blockquote>
</blockquote>
</body>
</html>
|
|
|
Powered by
FUDForum. Page generated in 0.49156 seconds