mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
- added escaping of & character for swt Link control
This commit is contained in:
parent
d8a11fe39c
commit
eb6e206f2b
1 changed files with 22 additions and 12 deletions
|
@ -49,10 +49,12 @@ public abstract class AbstractCodanProblemDetailsProvider {
|
||||||
String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
|
String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getProblemId() {
|
protected String getProblemId() {
|
||||||
String id = marker.getAttribute(IMarker.PROBLEM, (String) null); //$NON-NLS-1$
|
String id = marker.getAttribute(IMarker.PROBLEM, (String) null); //$NON-NLS-1$
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return true if provider can provide details for given marker (previously set by setMarker)
|
* return true if provider can provide details for given marker (previously set by setMarker)
|
||||||
* @param id - id of the problem
|
* @param id - id of the problem
|
||||||
|
@ -66,7 +68,7 @@ public abstract class AbstractCodanProblemDetailsProvider {
|
||||||
* marker message plus location.
|
* marker message plus location.
|
||||||
*/
|
*/
|
||||||
public String getStyledProblemMessage() {
|
public String getStyledProblemMessage() {
|
||||||
String message = getProblemMessage();
|
String message = escapeForLink(getProblemMessage());
|
||||||
String loc = marker.getResource().getFullPath().toOSString();
|
String loc = marker.getResource().getFullPath().toOSString();
|
||||||
int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
|
int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
|
||||||
return message + "\n" + loc + ":" + line; //$NON-NLS-1$//$NON-NLS-2$
|
return message + "\n" + loc + ":" + line; //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
@ -78,9 +80,17 @@ public abstract class AbstractCodanProblemDetailsProvider {
|
||||||
*/
|
*/
|
||||||
public String getStyledProblemDescription() {
|
public String getStyledProblemDescription() {
|
||||||
String id = getProblemId();
|
String id = getProblemId();
|
||||||
if (id==null) return ""; //$NON-NLS-1$
|
if (id == null)
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
IProblem problem = CodanRuntime.getInstance().getChechersRegistry().getDefaultProfile().findProblem(id);
|
IProblem problem = CodanRuntime.getInstance().getChechersRegistry().getDefaultProfile().findProblem(id);
|
||||||
return problem.getDescription();
|
return escapeForLink(problem.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to escape characters which are interpreted by Link swt control,
|
||||||
|
* such as & (mnemonic)
|
||||||
|
*/
|
||||||
|
protected String escapeForLink(String text) {
|
||||||
|
return text.replaceAll("&", "&&"); //$NON-NLS-2$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue