Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 285941 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaTaskHyperlinkDetectorTest.java (+36 lines)
Lines 113-118 Link Here
113
		shell.dispose();
113
		shell.dispose();
114
	}
114
	}
115
115
116
	public void testBeginningWithSpecialChars() {
117
		for (String format : formats) {
118
			String testString = "First line\n:" + format + " is at the beginning";
119
			viewer.setDocument(new Document(testString));
120
			Region region = new Region(0, testString.length());
121
			IHyperlink[] links = detector.detectHyperlinks(viewer, region, false);
122
			assertNotNull(links);
123
			assertEquals(1, links.length);
124
			assertEquals(testString.indexOf(format), links[0].getHyperlinkRegion().getOffset());
125
		}
126
	}
127
128
	public void testBeginningOfSecondLine() {
129
		for (String format : formats) {
130
			String testString = "First line\n" + format + " is at the beginning";
131
			viewer.setDocument(new Document(testString));
132
			Region region = new Region(0, testString.length());
133
			IHyperlink[] links = detector.detectHyperlinks(viewer, region, false);
134
			assertNotNull(links);
135
			assertEquals(1, links.length);
136
			assertEquals(testString.indexOf(format), links[0].getHyperlinkRegion().getOffset());
137
		}
138
	}
139
140
	public void testBeginningOfSecondLineWithisWhitespace() {
141
		for (String format : formats) {
142
			String testString = "First line\n \t " + format + " is at the beginning";
143
			viewer.setDocument(new Document(testString));
144
			Region region = new Region(0, testString.length());
145
			IHyperlink[] links = detector.detectHyperlinks(viewer, region, false);
146
			assertNotNull(links);
147
			assertEquals(1, links.length);
148
			assertEquals(testString.indexOf(format), links[0].getHyperlinkRegion().getOffset());
149
		}
150
	}
151
116
	public void testBeginning() {
152
	public void testBeginning() {
117
		for (String format : formats) {
153
		for (String format : formats) {
118
			String testString = format + " is at the beginning";
154
			String testString = format + " is at the beginning";
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java (-3 / +2 lines)
Lines 54-60 Link Here
54
54
55
	private static final int ATTACHMENT_NUM_GROUP = 6;
55
	private static final int ATTACHMENT_NUM_GROUP = 6;
56
56
57
	private static final String regexp = "(?:(duplicate of|(\\s|^)+bug|(\\s|^)+task)( ?#? ?)(\\d+))|(?:Created an attachment\\s*\\(id=(\\d+)\\))"; //$NON-NLS-1$
57
	private static final String regexp = "(?:(duplicate of|(\\W||^)+bug|(\\W|^)+task)( ?#? ?)(\\d+))|(?:Created an attachment\\s*\\(id=(\\d+)\\))"; //$NON-NLS-1$
58
58
59
	private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
59
	private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
60
60
Lines 196-203 Link Here
196
			start = m.start() + m.group().indexOf(m.group(TASK_NUM_GROUP));
196
			start = m.start() + m.group().indexOf(m.group(TASK_NUM_GROUP));
197
		} else {
197
		} else {
198
			start = m.start();
198
			start = m.start();
199
			if (m.group().startsWith(" ")) { //$NON-NLS-1$
199
			for (int index = 0; index < m.group().length() && !Character.isLetter(m.group().charAt(index)); index++, start++) {
200
				start++;
201
			}
200
			}
202
		}
201
		}
203
202

Return to bug 285941