diff options
author | Alena Laskavaia | 2010-07-22 01:48:07 +0000 |
---|---|---|
committer | Alena Laskavaia | 2010-07-22 01:48:07 +0000 |
commit | ec4b080977f8fbf6d30419c9f59d8e9d2c63f749 (patch) | |
tree | af1a9182c88ff873dc62175d3a5e542e94804249 /codan/org.eclipse.cdt.codan.ui | |
parent | 93ab595f8c934d7b18448393f21cc9cd8fcf8a7e (diff) | |
download | org.eclipse.cdt-ec4b080977f8fbf6d30419c9f59d8e9d2c63f749.tar.gz org.eclipse.cdt-ec4b080977f8fbf6d30419c9f59d8e9d2c63f749.tar.xz org.eclipse.cdt-ec4b080977f8fbf6d30419c9f59d8e9d2c63f749.zip |
allow to define quick fixes for gcc problems (not codan) as well
Diffstat (limited to 'codan/org.eclipse.cdt.codan.ui')
4 files changed, 27 insertions, 11 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui/plugin.xml b/codan/org.eclipse.cdt.codan.ui/plugin.xml index c1284b72bb7..c56460c3cf4 100644 --- a/codan/org.eclipse.cdt.codan.ui/plugin.xml +++ b/codan/org.eclipse.cdt.codan.ui/plugin.xml @@ -102,12 +102,11 @@ <viewShortcut id="org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"/> </perspectiveExtension> </extension> - - <extension + <extension point="org.eclipse.ui.ide.markerResolution"> <markerResolutionGenerator class="org.eclipse.cdt.codan.internal.ui.CodanProblemMarkerResolutionGenerator" - markerType="org.eclipse.cdt.codan.core.codanProblem"> + markerType="org.eclipse.cdt.core.problem"> </markerResolutionGenerator> </extension> </plugin> diff --git a/codan/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd b/codan/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd index 4cdbf233f09..c9c9ca64135 100644 --- a/codan/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd +++ b/codan/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd @@ -7,7 +7,6 @@ </appinfo> <documentation> Extension point to plugin quick fix for codan markers - </documentation> </annotation> @@ -65,10 +64,11 @@ </appinfo> </annotation> </attribute> - <attribute name="problemId" type="string" use="required"> + <attribute name="problemId" type="string"> <annotation> <documentation> - Problem id of the problem for which quick fix is defined + Problem id of the problem for which quick fix is defined. +If this is not codan problem (for example gcc error), it can be ommitted. Message pattern must be used in this case. </documentation> <appinfo> <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.codan.core.checkers/checker/problem/@id"/> diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java index 7065ad299ab..73fc4665b56 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java @@ -48,7 +48,7 @@ public class CodanProblemMarkerResolutionGenerator implements readExtensions(); } String id = marker.getAttribute(IMarker.PROBLEM, null); - if (id == null) + if (id == null && resolutions.get(null) == null) return new IMarkerResolution[0]; String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$ Collection<ConditionalResolution> collection = resolutions.get(id); @@ -62,7 +62,8 @@ public class CodanProblemMarkerResolutionGenerator implements continue; } if (res.res instanceof AbstractCodanCMarkerResolution) { - if (!((AbstractCodanCMarkerResolution)res.res).isApplicable(marker)) + if (!((AbstractCodanCMarkerResolution) res.res) + .isApplicable(marker)) continue; } list.add(res.res); @@ -97,7 +98,9 @@ public class CodanProblemMarkerResolutionGenerator implements IConfigurationElement configurationElement) { if (configurationElement.getName().equals("resolution")) { //$NON-NLS-1$ String id = configurationElement.getAttribute("problemId"); //$NON-NLS-1$ - if (id == null) { + String messagePattern = configurationElement + .getAttribute("messagePattern"); //$NON-NLS-1$ + if (id == null && messagePattern == null) { CodanUIActivator.log("Extension for " + EXTENSION_POINT_NAME //$NON-NLS-1$ + " problemId is not defined"); //$NON-NLS-1$ return; @@ -110,8 +113,6 @@ public class CodanProblemMarkerResolutionGenerator implements CodanUIActivator.log(e); return; } - String messagePattern = configurationElement - .getAttribute("messagePattern"); //$NON-NLS-1$ if (messagePattern != null) { try { Pattern.compile(messagePattern); diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java index c3105776732..9fd08787230 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java @@ -230,4 +230,20 @@ public abstract class AbstractCodanCMarkerResolution implements IIndex index = CCorePlugin.getIndexManager().getIndex(cProject); return index; } + + /** + * @param marker + * @return + */ + public String getProblemId(IMarker marker) { + return CodanProblemMarker.getProblemId(marker); + } + + /** + * @param marker + * @return + */ + public String getProblemMessage(IMarker marker) { + return CodanProblemMarker.getMessage(marker); + } } |