Changing unresolved reference diagnostic severity to warning [message #547267] |
Fri, 16 July 2010 03:28  |
Eclipse User |
|
|
|
Hi,
I tried to change the unresolved reference diagnostic severity from error to warning.
Therefore I've overridden LinkingDiagnosticMessageProvider so that the created DiagnosticMessage's severity will be WARNING:
public class MyLinkingDiagnosticMessageProvider extends
LinkingDiagnosticMessageProvider {
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
EClass referenceType = context.getReference().getEReferenceType();
String msg = "Couldn't resolve reference to " + referenceType.getName() + " '" + context.getLinkText() + "'.";
// only change ERROR to WARNING
//return new DiagnosticMessage(msg, DiagnosticSeverity.ERROR, Diagnostic.LINKING_DIAGNOSTIC);
return new DiagnosticMessage(msg, DiagnosticSeverity.WARNING, Diagnostic.LINKING_DIAGNOSTIC);
}
}
This works well except that the warning won't be removed anymore. When closing and reopening the file, all warnings are removed properly but not at "runtime". With severity level ERROR everything works fine.
Seems that I have forgotten to change the level somewhere else...
Any hint?
|
|
|
Re: Changing unresolved reference diagnostic severity to warning [message #548303 is a reply to message #547267] |
Wed, 21 July 2010 08:06   |
Eclipse User |
|
|
|
Hi Alex,
this is a bug - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=320490
Workaround:
Override XtextResource#addSyntaxErrors() with
getWarnings().clear();
super.addSyntaxErrors();
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 16.07.10 09:28, schrieb Alex:
> Hi,
>
> I tried to change the unresolved reference diagnostic severity from
> error to warning.
> Therefore I've overridden LinkingDiagnosticMessageProvider so that the
> created DiagnosticMessage's severity will be WARNING:
>
> public class MyLinkingDiagnosticMessageProvider extends
> LinkingDiagnosticMessageProvider {
>
> public DiagnosticMessage
> getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
> EClass referenceType = context.getReference().getEReferenceType();
> String msg = "Couldn't resolve reference to " + referenceType.getName()
> + " '" + context.getLinkText() + "'.";
> // only change ERROR to WARNING
> //return new DiagnosticMessage(msg, DiagnosticSeverity.ERROR,
> Diagnostic.LINKING_DIAGNOSTIC);
> return new DiagnosticMessage(msg, DiagnosticSeverity.WARNING,
> Diagnostic.LINKING_DIAGNOSTIC);
> }
> }
> This works well except that the warning won't be removed anymore. When
> closing and reopening the file, all warnings are removed properly but
> not at "runtime". With severity level ERROR everything works fine.
> Seems that I have forgotten to change the level somewhere else...
>
> Any hint?
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03645 seconds