mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
[272936] - fixed quick fix
This commit is contained in:
parent
cfa105d23c
commit
eaf73307bc
1 changed files with 10 additions and 1 deletions
|
@ -10,12 +10,21 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.checkers.ui.quickfix;
|
package org.eclipse.cdt.codan.checkers.ui.quickfix;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.ui.IMarkerResolution;
|
import org.eclipse.ui.IMarkerResolution;
|
||||||
import org.eclipse.ui.IMarkerResolutionGenerator;
|
import org.eclipse.ui.IMarkerResolutionGenerator;
|
||||||
|
|
||||||
public class CodanProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
|
public class CodanProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
|
||||||
public IMarkerResolution[] getResolutions(IMarker marker) {
|
public IMarkerResolution[] getResolutions(IMarker marker) {
|
||||||
return new IMarkerResolution[] { new QuickFixAssignmentInCondition() };
|
final Pattern patternBuildDependsAdd = Pattern.compile("Possible assignment in condition.*");
|
||||||
|
String description = marker.getAttribute(IMarker.MESSAGE, "no message");
|
||||||
|
Matcher matcherBuildDependsAdd = patternBuildDependsAdd.matcher(description);
|
||||||
|
if (matcherBuildDependsAdd.matches()) {
|
||||||
|
return new IMarkerResolution[] { new QuickFixAssignmentInCondition() };
|
||||||
|
}
|
||||||
|
return new IMarkerResolution[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue