KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > hyperlink > IHyperlinkDetector


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.jface.text.hyperlink;
12
13 import org.eclipse.jface.text.IRegion;
14 import org.eclipse.jface.text.ITextViewer;
15 import org.eclipse.jface.text.source.SourceViewerConfiguration;
16
17
18 /**
19  * A hyperlink detector tries to find a hyperlink at
20  * a given location in a given text viewer.
21  * <p>
22  * In order to provide backward compatibility for clients of <code>IHyperlinkDetector</code>, extension
23  * interfaces are used to provide a means of evolution. The following extension interfaces exist:
24  * <ul>
25  * <li>{@link IHyperlinkDetectorExtension} since version 3.3,
26  * adds the ability to dispose a hyperlink detector
27  * </li>
28  * <li>{@link IHyperlinkDetectorExtension2} since version 3.3,
29  * adds the ability to specify the state mask of the modifier
30  * keys that need to be pressed for this hyperlink detector
31  * </li>
32  * </ul></p>
33  * <p>
34  * Clients may implement this interface.
35  * </p>
36  *
37  * @see SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
38  * @since 3.1
39  */

40 public interface IHyperlinkDetector {
41
42     /**
43      * Tries to detect hyperlinks for the given region in
44      * the given text viewer and returns them.
45      * <p>
46      * In most of the cases only one hyperlink should be returned.
47      * </p>
48      * @param textViewer the text viewer on which the hover popup should be shown
49      * @param region the text range in the text viewer which is used to detect the hyperlinks
50      * @param canShowMultipleHyperlinks tells whether the caller is able to show multiple links
51      * to the user.
52      * If <code>true</code> {@link IHyperlink#open()} should directly open
53      * the link and not show any additional UI to select from a list.
54      * If <code>false</code> this method should only return one hyperlink
55      * which upon {@link IHyperlink#open()} may allow to select from a list.
56      * @return the hyperlinks or <code>null</code> if no hyperlink was detected
57      */

58     IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks);
59
60 }
61
Popular Tags