|
Re: [acceleo] How to detect generation errors ? [message #1005935 is a reply to message #1004473] |
Tue, 29 January 2013 10:50 |
|
Hi,
Acceleo uses the standard logging mechanism of the Eclipse platform. If you wish to listen and react to the error logged, you should use an instance of "org.eclipse.core.runtime.ILogListener" that you should plug to the platform like this:
if (Platform.isRunning()) {
Platform.addLogListener(logListener);
}
Inside, you should have somthing like this:
/**
* {@inheritDoc}
*
* @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus,
* java.lang.String)
*/
public void logging(IStatus status, String plugin) {
if (status.getPlugin().startsWith("org.eclipse.acceleo") //$NON-NLS-1$
|| status.getPlugin().startsWith("org.eclipse.ocl") //$NON-NLS-1$
|| AcceleoEnginePlugin.PLUGIN_ID.equals(status.getPlugin())) {
// do something!
}
}
And don't forget to remove your listener afterward.
if (Platform.isRunning()) {
Platform.removeLogListener(logListener);
}
Regards,
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
|
|
|
Powered by
FUDForum. Page generated in 0.02116 seconds