Result (final Matcher matcher, final int entireLen) { final String filePath = matcher.group(myFileRegister); String lineNumber = "0"; String columnNumber = "0"; if (myLineRegister != -1) { lineNumber = matcher.group(myLineRegister); } if (myColumnRegister != -1) { columnNumber = matcher.group(myColumnRegister); } int line = 0; int column = 0; try { line = Integer.parseInt(lineNumber); column = Integer.parseInt(columnNumber); } catch (NumberFormatException e) { // Do nothing, so that line and column will remain at their initial // zero values. } if (line > 0) line -= 1; if (column > 0) column -= 1; // Calculate the offsets relative to the entire text. final int highlightStartOffset; final int highlightEndOffset; if ((filePath == null || filePath.length() == 0) && myLineRegister != -1) { highlightStartOffset = entireLen + matcher.start(myLineRegister); highlightEndOffset = highlightStartOffset + lineNumber.length(); } else { highlightStartOffset = entireLen + matcher.start(myFileRegister); highlightEndOffset = highlightStartOffset + filePath.length(); } final HyperlinkInfo info = createOpenFileHyperlink(filePath, line, column); // don't return a result if the filename cannot be resolved to a file return info != null ? new Result(highlightStartOffset, highlightEndOffset, info) : null; }