Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2010-04-28 17:39:09 -0400
committerAlena Laskavaia2010-04-28 17:39:09 -0400
commitdb7ec65b7217fe08b0baeac14e1db079a5615d19 (patch)
tree9deed5a28437011d611cf26ff5cac069689d03fd /codan/org.eclipse.cdt.codan.examples
parent97285f3b569f3a509313430ea8fd7459c44cb435 (diff)
downloadorg.eclipse.cdt-db7ec65b7217fe08b0baeac14e1db079a5615d19.tar.gz
org.eclipse.cdt-db7ec65b7217fe08b0baeac14e1db079a5615d19.tar.xz
org.eclipse.cdt-db7ec65b7217fe08b0baeac14e1db079a5615d19.zip
- added extension point to provide problem details in Problem Details view and example of doing so for Flexlint
Diffstat (limited to 'codan/org.eclipse.cdt.codan.examples')
-rw-r--r--codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF3
-rw-r--r--codan/org.eclipse.cdt.codan.examples/plugin.xml7
-rw-r--r--codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/FlexlintHelpLink.java39
3 files changed, 48 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF
index ff72dae7e3..d230e8e3de 100644
--- a/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.codan.core.cxx;bundle-version="1.0.0",
org.eclipse.cdt.codan.core;bundle-version="1.0.0",
org.eclipse.cdt.core,
- org.eclipse.core.resources
+ org.eclipse.core.resources,
+ org.eclipse.cdt.codan.ui;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/codan/org.eclipse.cdt.codan.examples/plugin.xml b/codan/org.eclipse.cdt.codan.examples/plugin.xml
index f9a68351b5..57ba95cf73 100644
--- a/codan/org.eclipse.cdt.codan.examples/plugin.xml
+++ b/codan/org.eclipse.cdt.codan.examples/plugin.xml
@@ -19,4 +19,11 @@
</problem>
</checker>
</extension>
+ <extension
+ point="org.eclipse.cdt.codan.ui.codanProblemDetails">
+ <problemDetails
+ class="org.eclipse.cdt.codan.examples.uicontrib.FlexlintHelpLink"
+ >
+ </problemDetails>
+ </extension>
</plugin>
diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/FlexlintHelpLink.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/FlexlintHelpLink.java
new file mode 100644
index 0000000000..af2668969a
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/FlexlintHelpLink.java
@@ -0,0 +1,39 @@
+package org.eclipse.cdt.codan.examples.uicontrib;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
+
+public class FlexlintHelpLink extends AbstractCodanProblemDetailsProvider {
+ @Override
+ public boolean isApplicable(String id) {
+ String helpId = parseHelpId(getProblemMessage());
+ return helpId != null;
+ }
+ private Pattern messagePattern = Pattern.compile("(Warning|Error|Note|Info) #([0-9]+)"); //$NON-NLS-1$
+
+ private String parseHelpId(String problemMessage) {
+ // Warning #613:
+ // Note #613:
+ // Error #613:
+ String helpId = null;
+ Matcher matcher = messagePattern.matcher(problemMessage);
+ if (matcher.find()) {
+ helpId = matcher.group(2);
+ }
+ return helpId;
+ }
+
+ @Override
+ public URL getHelpURL() {
+ String helpId = parseHelpId(getProblemMessage());
+ try {
+ return new URL("http://www.gimpel-online.com/MsgRef.html#" + helpId); //$NON-NLS-1$
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+}

Back to the top