Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320490

Summary: [Linking] Resource#getWarnings not cleared before linking
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: sebastian.zarnekow: helios+
Version: 1.0.0   
Target Milestone: SR1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sebastian Zarnekow CLA 2010-07-21 08:06:29 EDT
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.
Comment 1 Sebastian Zarnekow CLA 2010-07-21 10:52:06 EDT
Fixed in HEAD.
Comment 2 Karsten Thoms CLA 2017-09-19 15:59:20 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.