blob: 4c8b5d3af715d5bbf855f1000f4df8e0334e4886 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*******************************************************************************
* 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 java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
/**
* Example of codan problem details provider for flexlint integration
*/
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 String getStyledProblemDescription() {
String helpId = parseHelpId(getProblemMessage());
String url = "http://www.gimpel-online.com/MsgRef.html#" + helpId;
return "<a href=\"" + url + "\">" + url + "</a>";
}
}
|