|
Re: Custom ResourceLocator for the generated Validator [message #633151 is a reply to message #633136] |
Fri, 15 October 2010 14:00 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090103000806080900060207
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Ralph,
Generally I'd expect it to refer to the plugin for the model and to add
messages to the plugin.properties
public ResourceLocator getResourceLocator()
{
return XyzPlugin.INSTANCE;
}
Ralph wrote:
> Hello,
>
> I'm having problems with custumizing the EMF-generated
> MyModelValidator. What I want to do is define custom error messages
> for my own constraints.
> Since I don't want to redefine generic String resources for every
> possible error during validation, it would be great if I could just
> add my own Strings to the existing resource. Unfortunately it's not
> any of the "plugin.properties" files the standard ResourceLocator uses.
>
> There are several examples of how to specialize the Validator class in
> the EMF handbook but none of them shows how to override the
> getResourceLocator() method.
>
> This is how the fresh getResourceLocator method looks like:
>
> /**
> * Returns the resource locator that will be used to fetch messages
> for this validator's diagnostics.
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> * @generated
> */
> @Override
> public ResourceLocator getResourceLocator() {
> // TODO
> // Specialize this to return a resource locator for messages
> specific to this validator.
> // Ensure that you remove @generated or mark it @generated NOT
> return super.getResourceLocator();
> }
>
> Thanks in advance!
> Ralph
--------------090103000806080900060207
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ralph,<br>
<br>
Generally I'd expect it to refer to the plugin for the model and to add
messages to the plugin.properties<br>
<blockquote><small> public ResourceLocator getResourceLocator()</small><br>
<small> {</small><br>
<small> return XyzPlugin.INSTANCE;</small><br>
<small> }</small><br>
</blockquote>
<br>
Ralph wrote:
<blockquote cite="mid:i99kqr$26u$1@news.eclipse.org" type="cite">Hello,
<br>
<br>
I'm having problems with custumizing the EMF-generated
MyModelValidator. What I want to do is define custom error messages for
my own constraints. <br>
Since I don't want to redefine generic String resources for every
possible error during validation, it would be great if I could just add
my own Strings to the existing resource. Unfortunately it's not any of
the "plugin.properties" files the standard ResourceLocator uses.
<br>
<br>
There are several examples of how to specialize the Validator class in
the EMF handbook but none of them shows how to override the
getResourceLocator() method.
<br>
<br>
This is how the fresh getResourceLocator method looks like:
<br>
<br>
/**
<br>
* Returns the resource locator that will be used to fetch messages
for this validator's diagnostics.
<br>
* <!-- begin-user-doc --> <!-- end-user-doc -->
<br>
* @generated
<br>
*/
<br>
@Override
<br>
public ResourceLocator getResourceLocator() {
<br>
// TODO
<br>
// Specialize this to return a resource locator for messages
specific to this validator.
<br>
// Ensure that you remove @generated or mark it @generated NOT
<br>
return super.getResourceLocator();
<br>
}
<br>
<br>
Thanks in advance!
<br>
Ralph
<br>
</blockquote>
</body>
</html>
--------------090103000806080900060207--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03046 seconds