org.netbeans.modules.editor.lib/3 3.23.0 19

org.netbeans.lib.editor.hyperlink.spi
Interface HyperlinkProviderExt


@MimeLocation(subfolderName="HyperlinkProviders")
public interface HyperlinkProviderExt

This interface should be implemented by anyone who whats to provide hyperlinking functionality in the source code.
Its methods are called for all the opened editors of the given mime-type where the hyperlinking functionality gets requested.

The providers need to be registered. For NetBeans IDE, the default approach is to use System FileSystem.
The HyperlinkProvider(s) should be registered as ".instance" objects under Editors/<mime-type>/HyperlinkProviders directory.

Please see lib.editor.hyperlink.HyperlinkProviderManager for more details.

Note: there is no assurance on the order of calling of the methods in this class. The callers may call the methods in any order and even do not call some of these methods at all.

Since:
1.18

Method Summary
 int[] getHyperlinkSpan(Document doc, int offset, HyperlinkType type)
          Should determine the span of hyperlink on given offset.
 Set<HyperlinkType> getSupportedHyperlinkTypes()
          Returns all hyperlink types that are supported by this HyperlinkProvider.
 String getTooltipText(Document doc, int offset, HyperlinkType type)
          Get a short description/tooltip corresponding to the given offset.
 boolean isHyperlinkPoint(Document doc, int offset, HyperlinkType type)
          Should determine whether there should be a hyperlink on the given offset in the given document.
 void performClickAction(Document doc, int offset, HyperlinkType type)
          The implementor should perform an action corresponding to clicking on the hyperlink on the given offset.
 

Method Detail

getSupportedHyperlinkTypes

Set<HyperlinkType> getSupportedHyperlinkTypes()
Returns all hyperlink types that are supported by this HyperlinkProvider. the resulting value should be constant over time.

Returns:
supported hyperlink types
Since:
1.18

isHyperlinkPoint

boolean isHyperlinkPoint(Document doc,
                         int offset,
                         HyperlinkType type)
Should determine whether there should be a hyperlink on the given offset in the given document. May be called any number of times for given parameters.
This method is called from event dispatch thread. It should run very fast as it is called very often.

Parameters:
doc - document on which to operate.
offset - >=0 offset to test (it generally should be offset < doc.getLength(), but the implementations should not depend on it)
type - the hyperlink type
Returns:
true if the provided offset should be in a hyperlink false otherwise
Since:
1.18

getHyperlinkSpan

int[] getHyperlinkSpan(Document doc,
                       int offset,
                       HyperlinkType type)
Should determine the span of hyperlink on given offset. Generally, if isHyperlinkPoint returns true for a given parameters, this class should return a valid span, but it is not strictly required.
This method is called from event dispatch thread. This method should run very fast as it is called very often.

Parameters:
doc - document on which to operate.
offset - >=0 offset to test (it generally should be offset < doc.getLength(), but the implementations should not depend on it)
type - the hyperlink type
Returns:
a two member array which contains starting and ending offset of a hyperlink that should be on a given offset
Since:
1.18

performClickAction

void performClickAction(Document doc,
                        int offset,
                        HyperlinkType type)
The implementor should perform an action corresponding to clicking on the hyperlink on the given offset. The nature of the action is given by the nature of given hyperlink, but generally should open some resource or move cursor to certain place in the current document.

Parameters:
doc - document on which to operate.
offset - >=0 offset to test (it generally should be offset < doc.getLength(), but the implementations should not depend on it)
type - the hyperlink type
Since:
1.18

getTooltipText

String getTooltipText(Document doc,
                      int offset,
                      HyperlinkType type)
Get a short description/tooltip corresponding to the given offset. Should block until the result is computed. Is called in a working thread, not in AWT Event dispatch thread. Return null if there should be no tooltip.

Parameters:
doc - document on which to operate.
offset - >=0 offset to test (it generally should be offset < doc.getLength(), but the implementations should not depend on it)
type - the hyperlink type
Since:
1.18

org.netbeans.modules.editor.lib/3 3.23.0 19

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.