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

Bug 345368

Summary: AbstractValidationMarkerReader does not handle EMF Resources that uses "file" scheme URIs
Product: [Modeling] Ecoretools Reporter: Anders Forsell <aforsell1971>
Component: GeneralAssignee: Project Inbox <ecore-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Anders Forsell CLA 2011-05-11 03:36:41 EDT
Build Identifier: 20100617-1415

The class "org.eclipse.emf.ecoretools.diagram.ui.outline.decorator.AbstractValidationMarkerReader" has a private function "getFile" that only handles the "platform" URI scheme.
Unfortunately the function is "private", would be much better to use "protected" so that concrete classes can override and support other schemes.

The problem can easily be fixed by changing the implementation a bit:

    private IFile getFile(Resource resource) {
        URI uri = resource.getURI();
        uri = resource.getResourceSet().getURIConverter().normalize(uri);
        String scheme = uri.scheme();
        if (uri.isFile()) {
            return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(uri.toFileString()));
        } else if ("platform".equals(scheme) && uri.segmentCount() > 1 && "resource".equals(uri.segment(0))) { //$NON-NLS-1$ //$NON-NLS-2$
            StringBuffer platformResourcePath = new StringBuffer();
            for (int j = 1; j < uri.segmentCount(); ++j) {
                platformResourcePath.append('/');
                platformResourcePath.append(uri.segment(j));
            }
            return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformResourcePath.toString()));
        }
        return null;
    }



Reproducible: Always
Comment 1 Anders Forsell CLA 2011-05-11 03:41:37 EDT
In addition the three private methods should be change to protected methods in the class.