KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > editors > text > URLHyperlinkDetector


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.editors.text;
12
13 import org.eclipse.jface.text.IRegion;
14 import org.eclipse.jface.text.ITextViewer;
15 import org.eclipse.jface.text.hyperlink.IHyperlink;
16
17
18 /**
19  * URL hyperlink detector.
20  *
21  * @since 3.1
22  */

23 public class URLHyperlinkDetector extends org.eclipse.jface.text.hyperlink.URLHyperlinkDetector {
24
25     /*
26      * @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean)
27      */

28     public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
29         IHyperlink[] result= super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks);
30         if (result == null)
31             return null;
32         
33         for (int i= 0; i < result.length; i++) {
34             org.eclipse.jface.text.hyperlink.URLHyperlink hyperlink= (org.eclipse.jface.text.hyperlink.URLHyperlink)result[i];
35             result[i]= new URLHyperlink(hyperlink.getHyperlinkRegion(), hyperlink.getURLString());
36         }
37
38         return result;
39     }
40 }
41
Popular Tags