Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-03-03 20:52:56 +0000
committerfbecker2010-03-03 20:52:56 +0000
commit751da41a8942179496277d286f351c48e031a477 (patch)
tree08596e9cb77dc7c1ba58a064ea8348a56886a9e3 /org.eclipse.mylyn.bugzilla.ui/src
parentf30a00ca45c6978d58a1bc9d4cdb4beed6e6fcef (diff)
downloadorg.eclipse.mylyn.tasks-751da41a8942179496277d286f351c48e031a477.tar.gz
org.eclipse.mylyn.tasks-751da41a8942179496277d286f351c48e031a477.tar.xz
org.eclipse.mylyn.tasks-751da41a8942179496277d286f351c48e031a477.zip
NEW - bug 164221: [patch] Recognize comment#number link on bug editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=164221
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
index dfb6486d8..1046e1a3f 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
@@ -38,6 +38,7 @@ import org.eclipse.mylyn.tasks.core.ITaskComment;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.LegendElement;
import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
@@ -52,9 +53,19 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi {
private static final int TASK_NUM_GROUP = 5;
- private static final int ATTACHMENT_NUM_GROUP = 6;
+ private static final int COMMENT_NUM_GROUP = 10;
- private static final String regexp = "(?:(duplicate of|(\\W||^)+bug|(\\W|^)+task)( ?#? ?)(\\d+))|(?:Created an attachment\\s*\\(id=(\\d+)\\))"; //$NON-NLS-1$
+ private static final int ATTACHMENT_NUM_GROUP = 14;
+
+// private static final String regexp = "(?:(duplicate of|(\\W||^)+bug|(\\W|^)+task)( ?#? ?)(\\d+)((\\s)*(comment|c)(\\s#|#|#\\s|\\s|)(\\s\\d+|\\d+))?)|(?:Created an attachment\\s*\\(id=(\\d+)\\))"; //$NON-NLS-1$
+
+ private static final String regexp = "(?:(duplicate of|(\\W||^)+bug|(\\W|^)+task)( ?#? ?)(\\d+)((\\s)*(comment|c)(\\s#|#|#\\s|\\s|)(\\s\\d+|\\d+))?)|(?:(Created (an )?attachment\\s*(\\(id=)?(\\d+)))"; //$NON-NLS-1$
+//
+// private static final String regexp = "(?:(duplicate of|(\\W||^)+bug|(\\W|^)+task)( ?#? ?)(\\d+))|(?:(Created (an )?attachment\\s*(\\(id=)?(\\d+)))"; //$NON-NLS-1$
+//
+//
+// private static final String regexp = "(duplicate of|bug|task)( ?#? ?)(\\d+)"; //$NON-NLS-1$
+// private static final String regexp = "(duplicate of|bug|task)( ?#? ?)(\\d+)((\\s)*(comment|c)(\\s#|#|#\\s|\\s|)(\\s\\d+|\\d+))?"; //$NON-NLS-1$
private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
@@ -192,6 +203,8 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi {
int start = -1;
+ int a = m.groupCount();
+
if (m.group().startsWith("duplicate")) { //$NON-NLS-1$
start = m.start() + m.group().indexOf(m.group(TASK_NUM_GROUP));
} else {
@@ -209,17 +222,25 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi {
try {
start += regionOffset;
end += regionOffset;
- IRegion sregion = new Region(start, end - start);
String bugId = m.group(TASK_NUM_GROUP);
if (bugId == null) {
String attachmentId = m.group(ATTACHMENT_NUM_GROUP);
if (attachmentId != null) {
+ start = start + m.group().indexOf(m.group(ATTACHMENT_NUM_GROUP));
+
+ IRegion sregion = new Region(start, end - start);
return new TaskAttachmentHyperlink(sregion, repository, attachmentId);
}
} else {
bugId.trim();
- return new TaskHyperlink(sregion, repository, bugId);
+ IRegion sregion = new Region(start, end - start);
+ TaskHyperlink taskHyperLink = new TaskHyperlink(sregion, repository, bugId);
+ String commentId = m.group(COMMENT_NUM_GROUP);
+ if (commentId != null) {
+ taskHyperLink.setSelection(TaskAttribute.PREFIX_COMMENT + commentId);
+ }
+ return taskHyperLink;
}
} catch (NumberFormatException e) {

Back to the top