|
Re: Need information to override the default validation function body [message #479072 is a reply to message #479006] |
Sat, 08 August 2009 20:40 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------070908000603070301070306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Yigal,
Comments below.
Yigal Spinner wrote:
> I created an eCore and assigned annotation on the EClass to generate
> the validation. (Example Class1 with Key=constrains, value=data)
> The EMF generates the generic PackageValidator.java class and has a
> method to validate the class for example:
> validateClass1_data (Class1 class1, DiagnosticChain diagnostics,
> Map<Object, Object> context);
>
> Is there a way to supply a generic implementation for the body of this
> method?
No.
> and not get the default implementation that does nothing.
No.
>
> I tried to use the generation example and merge this class with a
> class I created that only have the method I want to supply the body
> for, but it overrides all the other methods and attributes and remove
> them.
>
> Can you direct me to a way I can generate the body during the EMF
> Model generation?
There isn't currently a way to do that with a named constraint. You
must modify the generated validator class. There's work being done on
which might change the story:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>
> Thanks Yigal.
--------------070908000603070301070306
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">
Yigal,<br>
<br>
Comments below.<br>
<br>
Yigal Spinner wrote:
<blockquote cite="mid:h5id5h$lqr$1@build.eclipse.org" type="cite">I
created an eCore and assigned annotation on the EClass to generate the
validation. (Example Class1 with Key=constrains, value=data)
<br>
The EMF generates the generic PackageValidator.java class and has a
method to validate the class for example:
<br>
validateClass1_data (Class1 class1, DiagnosticChain diagnostics,
Map<Object, Object> context);
<br>
<br>
Is there a way to supply a generic implementation for the body of this
method?</blockquote>
No.<br>
<blockquote cite="mid:h5id5h$lqr$1@build.eclipse.org" type="cite"> and
not get the default implementation that does nothing.
<br>
</blockquote>
No.<br>
<blockquote cite="mid:h5id5h$lqr$1@build.eclipse.org" type="cite"><br>
I tried to use the generation example and merge this class with a class
I created that only have the method I want to supply the body for, but
it overrides all the other methods and attributes and remove them.
<br>
<br>
Can you direct me to a way I can generate the body during the EMF Model
generation?
<br>
</blockquote>
There isn't currently a way to do that with a named constraint. You
must modify the generated validator class. There's work being done on
which might change the story:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786">https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786</a><br>
</blockquote>
<blockquote cite="mid:h5id5h$lqr$1@build.eclipse.org" type="cite"><br>
Thanks Yigal.
<br>
</blockquote>
</body>
</html>
--------------070908000603070301070306--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Need information to override the default validation function body [message #479123 is a reply to message #479122] |
Sun, 09 August 2009 15:47 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090709090801040904060604
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Yigal,
Did you do these steps?
http://wiki.eclipse.org/index.php/EMF/FAQ#What_are_Dynamic_T emplates.3F
Yigal Spinner wrote:
> Hi Ed,
> Thanks for the reply. I copied the ValidatorClass.javajet template
> and add it to my simple plugin (I used the example to add validator
> generation that comes with the product).
> I modified the template with some changes and it built the java class.
> When I run the EMF generation it does not pick the new Jet generation
> from my plugin.
> I changed in the genmodel the flag for dynamic generation to "true"
> and put the my plugin templates directory, but that did not help either.
> How can I override the ValidatorClass.java so I can get my code in?
>
> Thanks
> Yigal
>
>
>
> Ed Merks wrote:
>> Yigal,
>>
>> Comments below.
>>
>> Yigal Spinner wrote:
>>> I created an eCore and assigned annotation on the EClass to generate
>>> the validation. (Example Class1 with Key=constrains, value=data)
>>> The EMF generates the generic PackageValidator.java class and has a
>>> method to validate the class for example:
>>> validateClass1_data (Class1 class1, DiagnosticChain diagnostics,
>>> Map<Object, Object> context);
>>>
>>> Is there a way to supply a generic implementation for the body of
>>> this method?
>> No.
>>> and not get the default implementation that does nothing.
>> No.
>>>
>>> I tried to use the generation example and merge this class with a
>>> class I created that only have the method I want to supply the body
>>> for, but it overrides all the other methods and attributes and
>>> remove them.
>>>
>>> Can you direct me to a way I can generate the body during the EMF
>>> Model generation?
>> There isn't currently a way to do that with a named constraint. You
>> must modify the generated validator class. There's work being done
>> on which might change the story:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786
>>
>>>
>>> Thanks Yigal.
--------------090709090801040904060604
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">
Yigal,<br>
<br>
Did you do these steps?<br>
<blockquote><a
href=" http://wiki.eclipse.org/index.php/EMF/FAQ#What_are_Dynamic_T emplates.3F"> http://wiki.eclipse.org/index.php/EMF/FAQ#What_are_Dynamic_T emplates.3F</a><br>
</blockquote>
<br>
<br>
Yigal Spinner wrote:
<blockquote cite="mid:h5mq3p$bui$1@build.eclipse.org" type="cite">Hi
Ed,
<br>
Thanks for the reply. I copied the ValidatorClass.javajet template and
add it to my simple plugin (I used the example to add validator
generation that comes with the product).
<br>
I modified the template with some changes and it built the java class.
<br>
When I run the EMF generation it does not pick the new Jet generation
from my plugin.
<br>
I changed in the genmodel the flag for dynamic generation to "true" and
put the my plugin templates directory, but that did not help either.
<br>
How can I override the ValidatorClass.java so I can get my code in?
<br>
<br>
Thanks
<br>
Yigal
<br>
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Yigal,
<br>
<br>
Comments below.
<br>
<br>
Yigal Spinner wrote:
<br>
<blockquote type="cite">I created an eCore and assigned annotation
on the EClass to generate the validation. (Example Class1 with
Key=constrains, value=data)
<br>
The EMF generates the generic PackageValidator.java class and has a
method to validate the class for example:
<br>
validateClass1_data (Class1 class1, DiagnosticChain diagnostics,
Map<Object, Object> context);
<br>
<br>
Is there a way to supply a generic implementation for the body of this
method?
<br>
</blockquote>
No.
<br>
<blockquote type="cite">and not get the default implementation that
does nothing.
<br>
</blockquote>
No.
<br>
<blockquote type="cite"><br>
I tried to use the generation example and merge this class with a class
I created that only have the method I want to supply the body for, but
it overrides all the other methods and attributes and remove them.
<br>
<br>
Can you direct me to a way I can generate the body during the EMF Model
generation?
<br>
</blockquote>
There isn't currently a way to do that with a named constraint. You
must modify the generated validator class. There's work being done on
which might change the story:
<br>
<br>
<a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786">https://bugs.eclipse.org/bugs/show_bug.cgi?id=255786</a>
<br>
<br>
<blockquote type="cite"><br>
Thanks Yigal.
<br>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>
--------------090709090801040904060604--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Re: Need information to override the default validation function body [message #480068 is a reply to message #480066] |
Thu, 13 August 2009 16:47 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Yigal,
Yes, I'm trying to remember where that stuff is...
In JETEmitter's EclipseHelper.initialize method there's logic for
else if (templateURI.isPlatformPlugin())
{
So if the template path is a URI of the form
platform:/plugin/<plugin-id>/ then it will use the templates target java
class/file name to look up the .class in that bundle. So if you compile
the templates in a project with a JET nature then you (your clients)
will be able to load those precompiled templates.
Yigal Spinner wrote:
> Hi Ed,
> Thanks for the information it was very helpful. I was able to
> override the EMF templates and run my own templates.
> I found out that the best configuration is to put the ENF override
> templates in a separate directory then my templates.
> I'm glade the newsgroup works so well to get answers, otherwise there
> no other source.
>
> In you answer you indicated that the dynamic architecture uses the
> *.class. But while debugging the code I did not find any evidence for
> it and the architecture recompiles the templates every time. It
> recompiles my generation templates as well even if they are in a
> separate directory.
> This is fine except it increases the generation time.
>
> Thanks
> Yigal.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04411 seconds