Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-07-22 18:21:06 +0000
committersminto2005-07-22 18:21:06 +0000
commitffffb926b03d642989ad458377d815e21702126e (patch)
tree37a960e53365e04937332db36afa327a0db6fdfb /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn
parentd844b1fb369a546af8a4857c7a8e5fea8c652018 (diff)
downloadorg.eclipse.mylyn.tasks-ffffb926b03d642989ad458377d815e21702126e.tar.gz
org.eclipse.mylyn.tasks-ffffb926b03d642989ad458377d815e21702126e.tar.xz
org.eclipse.mylyn.tasks-ffffb926b03d642989ad458377d815e21702126e.zip
fixed hyperlink detector to make sure that bug <num> and bug# <num> is supported
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/bugs/java/BugzillaHyperLinkDetector.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/bugs/java/BugzillaHyperLinkDetector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/bugs/java/BugzillaHyperLinkDetector.java
index 46eb77217..89aa70e87 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/bugs/java/BugzillaHyperLinkDetector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/bugs/java/BugzillaHyperLinkDetector.java
@@ -1,6 +1,8 @@
package org.eclipse.mylar.bugs.java;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.dom.ASTNode;
@@ -86,14 +88,29 @@ public class BugzillaHyperLinkDetector extends AbstractMylarHyperlinkDetector {
int startOffset= region.getOffset();
int endOffset= startOffset + region.getLength();
- if(comment.toLowerCase().indexOf("bug") != -1){
+ Pattern p = Pattern.compile("^.*bug\\s+\\d+.*");
+ Matcher m = p.matcher(comment.toLowerCase().trim());
+ boolean b = m.matches();
+
+ p = Pattern.compile("^.*bug#\\s+\\d+.*");
+ m = p.matcher(comment.toLowerCase().trim());
+ boolean b2 = m.matches();
+
+ if(b || b2){
int start = comment.toLowerCase().indexOf("bug");
- int end = comment.indexOf(" ", start + 4);
+ int ahead = 4;
+ if(b2)
+ ahead = 5;
+ String endComment = comment.substring(start+ahead, comment.length());
+ endComment = endComment.trim();
+ int endCommentStart = comment.indexOf(endComment);
+
+ int end = comment.indexOf(" ", endCommentStart);
if(end == -1)
end = comment.length();
- int bugId = Integer.parseInt(comment.substring(start+4, end).trim());
+ int bugId = Integer.parseInt(comment.substring(endCommentStart, end).trim());
start += commentStart;
end += commentStart;

Back to the top