diff options
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.java | 128 |
1 files changed, 0 insertions, 128 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 3579bf5b8..ec6468170 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 @@ -32,7 +32,6 @@ import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaImages; import org.eclipse.mylyn.internal.bugzilla.ui.TaskAttachmentHyperlink; import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage; import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard; -import org.eclipse.mylyn.internal.tasks.core.AbstractTask; import org.eclipse.mylyn.tasks.core.IRepositoryQuery; import org.eclipse.mylyn.tasks.core.ITask; import org.eclipse.mylyn.tasks.core.ITaskComment; @@ -62,20 +61,6 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi { private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE); - private static final int GET_TASK_NUM_GROUP = 8; - - private static final int GET_COMMENT_NUM_GROUP = 13; - - private static final int GET_ATTACHMENT_NUM_GROUP = 3; - - private static final String regexp_bug = "(((duplicate of|((\\W||^)+(bug|task)))( ?#? ?)(\\d+))?((\\W||\\s)*(comment|c)??(\\s*#\\s*)(\\d+))?)"; //$NON-NLS-1$ - - private static final String regexp_attachment = "Created (an )?attachment\\s*(\\(id=)?(\\d+)"; //$NON-NLS-1$ - - private static final Pattern PATTERN_BUG = Pattern.compile(regexp_bug, Pattern.CASE_INSENSITIVE); - - private static final Pattern PATTERN_ATTACHMENT = Pattern.compile(regexp_attachment, Pattern.CASE_INSENSITIVE); - @Override public String getAccountCreationUrl(TaskRepository taskRepository) { return taskRepository.getRepositoryUrl() + "/createaccount.cgi"; //$NON-NLS-1$ @@ -260,117 +245,4 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi { return new BugzillaTaskAttachmentPage(model); } - @Override - public boolean supportGetHyperlinks() { - return true; - } - - @Override - public IHyperlink[] getHyperlinks(TaskRepository repository, AbstractTask task, String text, int index, - int textOffset) { - ArrayList<IHyperlink> hyperlinksFound = null; - Matcher mb = PATTERN_BUG.matcher(text); - while (mb.find()) { - if (index == -1 || (index >= mb.start() && index <= mb.end())) { - IHyperlink link = extractHyperlinkBug(repository, task, textOffset, mb); - if (link != null) { - if (hyperlinksFound == null) { - hyperlinksFound = new ArrayList<IHyperlink>(); - } - hyperlinksFound.add(link); - } - } - } - Matcher ma = PATTERN_ATTACHMENT.matcher(text); - while (ma.find()) { - if (index == -1 || (index >= ma.start() && index <= ma.end())) { - IHyperlink link = extractHyperlinkAttachment(repository, textOffset, ma); - if (link != null) { - if (hyperlinksFound == null) { - hyperlinksFound = new ArrayList<IHyperlink>(); - } - hyperlinksFound.add(link); - } - } - } - - return (hyperlinksFound != null) ? hyperlinksFound.toArray(new IHyperlink[0]) : null; - } - - private static IHyperlink extractHyperlinkBug(TaskRepository repository, AbstractTask task, int regionOffset, - Matcher m) { - - int start = m.start(); - if (m.group().startsWith("duplicate")) { //$NON-NLS-1$ - start = m.start() + m.group().indexOf(m.group(GET_TASK_NUM_GROUP)); - } else { - start = m.start(); - for (int index = 0; index < m.group().length() && !Character.isLetter(m.group().charAt(index)); index++, start++) { - } - } - - int end = m.end(); - - if (end == -1) { - end = m.group().length(); - } - - start += regionOffset; - end += regionOffset; - String bugId = m.group(GET_TASK_NUM_GROUP); - if (bugId == null) { - String commentId = m.group(GET_COMMENT_NUM_GROUP); - IRegion sregion = new Region(start, end - start); - if (commentId != null) { - String taskID; - if (task != null) { - taskID = task.getTaskId(); - } else { - taskID = ""; //$NON-NLS-1$ - } - TaskHyperlink taskHyperLink = new TaskHyperlink(sregion, repository, taskID); - if (commentId != null) { - taskHyperLink.setSelection(TaskAttribute.PREFIX_COMMENT + commentId); - } - return taskHyperLink; - - } - } else { - bugId.trim(); - IRegion sregion = new Region(start, end - start); - TaskHyperlink taskHyperLink = new TaskHyperlink(sregion, repository, bugId); - String commentId = m.group(GET_COMMENT_NUM_GROUP); - if (commentId != null) { - taskHyperLink.setSelection(TaskAttribute.PREFIX_COMMENT + commentId); - } - return taskHyperLink; - } - return null; - } - - private static IHyperlink extractHyperlinkAttachment(TaskRepository repository, int regionOffset, Matcher m) { - - int start = -1; - start = m.start(); - for (int index = 0; index < m.group().length() && !Character.isLetter(m.group().charAt(index)); index++, start++) { - } - - int end = m.end(); - - if (end == -1) { - end = m.group().length(); - } - - start += regionOffset; - end += regionOffset; - - String attachmentId = m.group(GET_ATTACHMENT_NUM_GROUP); - if (attachmentId != null) { - start = start + m.group().indexOf(m.group(GET_ATTACHMENT_NUM_GROUP)); - - IRegion sregion = new Region(start, end - start); - return new TaskAttachmentHyperlink(sregion, repository, attachmentId); - } - return null; - } } |