Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-13491] Center the affected source line in source view.
  • Loading branch information
uhafner committed Apr 27, 2012
1 parent bfc36fa commit 735e37429e4e22a54192a02ce3077872b6a978a7
Showing 4 changed files with 32 additions and 14 deletions.
@@ -314,6 +314,15 @@ public final int getPrimaryLineNumber() {
return primaryLineNumber;
}

/**
* Returns the line number that should be shown on top of the source code view.
*
* @return the line number
*/
public final int getLinkLineNumber() {
return Math.max(1, primaryLineNumber - 10);
}

/**
* Adds another line range to this annotation.
*
@@ -1,17 +1,12 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
xmlns:i="jelly:fmt" xmlns:local="local">
xmlns:i="jelly:fmt" xmlns:local="local" xmlns:u="/util">
<st:header name="Content-Type" value="text/html;charset=UTF-8" />
<j:forEach var="warning" items="${annotations.sortedAnnotations}">
<table class="pane" id="details">
<tr>
<td class="pane-header">
<j:choose>
<j:when test="${warning.canDisplayFile(it.owner)}">
<a href="source.${warning.key}/#${warning.primaryLineNumber}">${warning.shortFileName}:${warning.primaryLineNumber}</a>
</j:when>
<j:otherwise>${warning.shortFileName}:${warning.primaryLineNumber}</j:otherwise>
</j:choose>,
<u:sourceLink it="${it}" warning="${warning}"/>,
${warning.type}, ${%Priority}: ${warning.priority.localizedString}
<j:if test="${h.size2(warning.category) > 0}">
, ${%Category}: ${warning.category}
@@ -1,5 +1,5 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util"
xmlns:i="jelly:fmt" xmlns:local="local">
<st:header name="Content-Type" value="text/html;charset=UTF-8" />
<table class="pane sortable" id="warnings">
@@ -21,12 +21,7 @@
<tr>
<td class="pane">
<div tooltip="${warning.message}">
<j:choose>
<j:when test="${warning.canDisplayFile(it.owner)}">
<a href="source.${warning.key}/#${warning.primaryLineNumber}">${warning.shortFileName}</a>
</j:when>
<j:otherwise>${warning.shortFileName}</j:otherwise>
</j:choose>
<u:sourceLink it="${it}" warning="${warning}"/>
</div>
</td>
<j:if test="${it.container.modules.size() > 1}">
@@ -0,0 +1,19 @@
<!--
Section header
<%@attribute name="it" required="true" %>
<%@attribute name="warning" required="true" %>
-->

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
xmlns:f="/lib/form" xmlns:u="/util">

<j:choose>
<j:when test="${warning.canDisplayFile(it.owner)}">
<a href="source.${warning.key}/#${warning.linkLineNumber}">${warning.shortFileName}:${warning.primaryLineNumber}</a>
</j:when>
<j:otherwise>${warning.shortFileName}:${warning.primaryLineNumber}</j:otherwise>
</j:choose>

</j:jelly>

0 comments on commit 735e374

Please sign in to comment.