mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
fixed too long link in the problem details
This commit is contained in:
parent
b99d01ac98
commit
844b2fa4bd
2 changed files with 24 additions and 3 deletions
|
@ -111,15 +111,21 @@ public abstract class AbstractCodanProblemDetailsProvider {
|
|||
public String getStyledProblemMessage() {
|
||||
String message = escapeForLink(getProblemMessage());
|
||||
String href = getLocationHRef();
|
||||
String link = href.replaceFirst("^file:", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
link = link.replaceFirst("#(\\d+)$", ":$1"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
return "<a href=\"" + href + "\">" + link + "</a> \n" + message; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||
String link = getLocation();
|
||||
return "<a href=\"" + href + "\">" + link + "</a> \n" + message + "\n"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
protected String getLocationHRef() {
|
||||
return CodanEditorUtility.getLocationHRef(marker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
protected String getLocation() {
|
||||
return CodanEditorUtility.getLocation(marker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return styled problem description. This text would be used in Link
|
||||
* widget.
|
||||
|
|
|
@ -113,4 +113,19 @@ public class CodanEditorUtility {
|
|||
String href = loc + "#" + line; //$NON-NLS-1$
|
||||
return href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param marker
|
||||
* @return
|
||||
* @since 1.1
|
||||
*/
|
||||
public static String getLocation(IMarker marker) {
|
||||
String loc = marker.getResource().getFullPath().toPortableString();
|
||||
String loc2 = marker.getAttribute(IMarker.LOCATION, ""); //$NON-NLS-1$
|
||||
int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
|
||||
if (loc2.length() > 0) {
|
||||
loc = loc2.replaceAll("[^:]*: ", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return loc + ":" + line; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue