diff --git a/codan/org.eclipse.cdt.codan.examples/plugin.xml b/codan/org.eclipse.cdt.codan.examples/plugin.xml index 25b67e72be1..f12f7a82af9 100644 --- a/codan/org.eclipse.cdt.codan.examples/plugin.xml +++ b/codan/org.eclipse.cdt.codan.examples/plugin.xml @@ -29,7 +29,7 @@ defaultSeverity="Warning" description="Finds a strings in the code defined by user" id="org.eclipse.cdt.codan.examples.checkers.GrepCheckerProblemWarning" - messagePattern="{0}" + messagePattern="Found string {0}" name="Search string warning"> @@ -48,6 +48,10 @@ + + diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java index 44e55695d25..76629292cc7 100644 --- a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java +++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/GrepChecker.java @@ -78,7 +78,7 @@ public class GrepChecker extends AbstractCheckerWithProblemPreferences { for (int i = 0; i < values.length; i++) { String str = (String) values[i]; if (line.contains(str)) { - reportProblem(problem.getId(), file, iline, "Found " + str); + reportProblem(problem.getId(), file, iline, str); } } } diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/GrepCheckerHelpLink.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/GrepCheckerHelpLink.java new file mode 100644 index 00000000000..bfed0b3497e --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/uicontrib/GrepCheckerHelpLink.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2010 Alena Laskavaia and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.examples.uicontrib; + +import org.eclipse.cdt.codan.internal.core.model.CodanProblemMarker; +import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider; + +/** + * Example of codan problem details provider for flexlint integration + */ +public class GrepCheckerHelpLink extends AbstractCodanProblemDetailsProvider { + @Override + public boolean isApplicable(String id) { + return id.startsWith("org.eclipse.cdt.codan.examples.checkers.GrepCheckerProblem"); + } + + + @Override + public String getStyledProblemDescription() { + String arg = CodanProblemMarker.getProblemArgument(marker, 0); + String url = "http://www.google.ca/search?q=" + arg; + return "Google " + "" + arg + ""; + } +}