diff options
author | spingel | 2009-03-02 21:57:44 +0000 |
---|---|---|
committer | spingel | 2009-03-02 21:57:44 +0000 |
commit | af662b6d78084366fff3b965cccfc792d593b56c (patch) | |
tree | a53f9798732b781195c1b2918b80d917cfe3a067 | |
parent | f8534a4a534b35164be9c882d1200d07186fd9f0 (diff) | |
download | org.eclipse.mylyn.tasks-af662b6d78084366fff3b965cccfc792d593b56c.tar.gz org.eclipse.mylyn.tasks-af662b6d78084366fff3b965cccfc792d593b56c.tar.xz org.eclipse.mylyn.tasks-af662b6d78084366fff3b965cccfc792d593b56c.zip |
NEW - bug 266693: [patch] hyperlinks do not show as blue in task editor with WikiText enabled
https://bugs.eclipse.org/bugs/show_bug.cgi?id=266693
3 files changed, 40 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/.settings/.api_filters b/org.eclipse.mylyn.tasks.tests/.settings/.api_filters index f066a6cf4..e11c15704 100644 --- a/org.eclipse.mylyn.tasks.tests/.settings/.api_filters +++ b/org.eclipse.mylyn.tasks.tests/.settings/.api_filters @@ -1,11 +1,19 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> <component id="org.eclipse.mylyn.tasks.tests" version="2"> -<resource path="src/org/eclipse/mylyn/tasks/tests/ui/TaskHyperlinkDetectorTest.java" type="org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest"> -<filter id="571519004"> -<message_arguments> -<message_argument value="org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest"/> -<message_argument value="TextViewer"/> -</message_arguments> -</filter> -</resource> + <resource path="src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java" type="org.eclipse.mylyn.tasks.tests.ui.editor.TaskUrlHyperlinkDetectorTest"> + <filter id="571519004"> + <message_arguments> + <message_argument value="org.eclipse.mylyn.tasks.tests.ui.editor.TaskUrlHyperlinkDetectorTest"/> + <message_argument value="TextViewer"/> + </message_arguments> + </filter> + </resource> + <resource path="src/org/eclipse/mylyn/tasks/tests/ui/TaskHyperlinkDetectorTest.java" type="org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest"> + <filter id="571519004"> + <message_arguments> + <message_argument value="org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest"/> + <message_argument value="TextViewer"/> + </message_arguments> + </filter> + </resource> </component> diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java index a19ae6eb2..d90f17b30 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/editor/TaskUrlHyperlinkDetectorTest.java @@ -7,6 +7,7 @@ * * Contributors: * Tasktop Technologies - initial API and implementation + * David Green - fix for bug 266693 *******************************************************************************/ package org.eclipse.mylyn.tasks.tests.ui.editor; @@ -24,6 +25,7 @@ import org.eclipse.mylyn.internal.tasks.ui.editors.TaskUrlHyperlinkDetector; /** * @author Steffen Pingel + * @author David Green */ public class TaskUrlHyperlinkDetectorTest extends TestCase { @@ -72,4 +74,16 @@ public class TaskUrlHyperlinkDetectorTest extends TestCase { assertEquals("http://foo", ((TaskUrlHyperlink) links[0]).getURLString()); } + public void testDetectionUsingExtent() { + IHyperlink[] hyperlinks = detect("aa http://www.eclipse.org test", 0, 30); + assertNotNull(hyperlinks); + assertEquals(1, hyperlinks.length); + } + + public void testDetection() { + IHyperlink[] hyperlinks = detect("aa http://www.eclipse.org test", 20, 0); + assertNotNull(hyperlinks); + assertEquals(1, hyperlinks.length); + } + } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java index d4bd501dc..27b288e09 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 Tasktop Technologies and others. + * Copyright (c) 2004, 2008 Tasktop Technologies and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Tasktop Technologies - initial API and implementation + * David Green - fix for bug 266693 *******************************************************************************/ package org.eclipse.mylyn.internal.tasks.ui.editors; @@ -55,10 +56,10 @@ public class TaskUrlHyperlinkDetector extends AbstractHyperlinkDetector { int offsetInLine = offset - lineInfo.getOffset(); - return findHyperlinks(line, offsetInLine, lineInfo.getOffset()); + return findHyperlinks(line, offsetInLine, lineInfo.getOffset(), region.getLength()); } - public IHyperlink[] findHyperlinks(String line, int offsetInLine, int offset) { + private IHyperlink[] findHyperlinks(String line, int offsetInLine, int offset, int regionLength) { char doubleChar = ' '; String urlString = null; @@ -112,7 +113,11 @@ public class TaskUrlHyperlinkDetector extends AbstractHyperlinkDetector { } urlLength = tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine; - if (offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength) { + if ((regionLength == 0 && offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength) + || ((regionLength > 0 && offsetInLine <= urlOffsetInLine && (offsetInLine + regionLength) > urlOffsetInLine))) { + // region length of 0 and offset hits within the hyperlink url + // OR + // region spans the start of the hyperlink url. break; } |