mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
added a method to reurn problem instance by marker
This commit is contained in:
parent
38cea0f9eb
commit
3bceaf6856
1 changed files with 13 additions and 0 deletions
|
@ -11,6 +11,9 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.codan.ui;
|
||||
|
||||
import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
||||
import org.eclipse.cdt.codan.core.model.IProblemProfile;
|
||||
import org.eclipse.cdt.codan.internal.core.model.CodanProblemMarker;
|
||||
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -235,6 +238,16 @@ public abstract class AbstractCodanCMarkerResolution implements ICodanMarkerReso
|
|||
return CodanProblemMarker.getProblemId(marker);
|
||||
}
|
||||
|
||||
public IProblem getProblem(IMarker marker) {
|
||||
IPath path = marker.getResource().getFullPath();
|
||||
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
|
||||
if (file == null)
|
||||
return null;
|
||||
IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(file);
|
||||
String id = getProblemId(marker);
|
||||
return profile.findProblem(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param marker
|
||||
* @return
|
||||
|
|
Loading…
Add table
Reference in a new issue