Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345368 - AbstractValidationMarkerReader does not handle EMF Resources that uses "file" scheme URIs
Summary: AbstractValidationMarkerReader does not handle EMF Resources that uses "file"...
Status: NEW
Alias: None
Product: Ecoretools
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 03:36 EDT by Anders Forsell CLA
Modified: 2011-05-11 03:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.