1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 525953 - Simplify the implementation of AbstractCodanCMarkerResolution.getProblem()

In the process, the (problematic) assumption the function previously
made that a marker's resource will be a file, has been removed.

Change-Id: I657e1e99d9b06921558ca13960b4fd3ad554911d
This commit is contained in:
Nathan Ridge 2017-10-20 00:34:24 -04:00
parent e96d2f92c8
commit acd931e2b6

View file

@ -29,6 +29,7 @@ import org.eclipse.cdt.ui.CDTUITools;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -273,11 +274,8 @@ public abstract class AbstractCodanCMarkerResolution implements ICodanMarkerReso
} }
public IProblem getProblem(IMarker marker) { public IProblem getProblem(IMarker marker) {
IPath path = marker.getResource().getFullPath(); IResource resource = marker.getResource();
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(resource);
if (file == null)
return null;
IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(file);
String id = getProblemId(marker); String id = getProblemId(marker);
return profile.findProblem(id); return profile.findProblem(id);
} }