站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

CompletionProvider (NetBeans Editor Code Completion SPI) - NetBeans API Javadoc 5.0.0

 

org.netbeans.spi.editor.completion
Interface CompletionProvider


public interface CompletionProvider

The basic interface of the code completion querying SPI. Various implementations can be registered per a document mime-type.


Field Summary
static int COMPLETION_QUERY_TYPE
          The int value representing the query for a code completion.
static int DOCUMENTATION_QUERY_TYPE
          The int value representing the query for a documentation.
static int TOOLTIP_QUERY_TYPE
          The int value representing the query for a tooltip hint.
 
Method Summary
 CompletionTask createTask(int queryType, JTextComponent component)
          Creates a task that performs a query of the given type on the given component.
 int getAutoQueryTypes(JTextComponent component, String typedText)
          Called by the code completion infrastructure to check whether a text just typed into a text component triggers an automatic query invocation.
 

Field Detail

COMPLETION_QUERY_TYPE

public static final int COMPLETION_QUERY_TYPE
The int value representing the query for a code completion.

See Also:
Constant Field Values

DOCUMENTATION_QUERY_TYPE

public static final int DOCUMENTATION_QUERY_TYPE
The int value representing the query for a documentation.

See Also:
Constant Field Values

TOOLTIP_QUERY_TYPE

public static final int TOOLTIP_QUERY_TYPE
The int value representing the query for a tooltip hint.

See Also:
Constant Field Values
Method Detail

createTask

public CompletionTask createTask(int queryType,
                                 JTextComponent component)
Creates a task that performs a query of the given type on the given component.
This method is invoked in AWT thread only and the returned task may either be synchronous (if it's not complex) or it may be asynchonous (see AsyncCompletionTask).
The task usually inspects the component's document, the text up to the caret position and returns the appropriate result.

Parameters:
queryType - a type ot the query. It can be one of the COMPLETION_QUERY_TYPE, DOCUMENTATION_QUERY_TYPE, or TOOLTIP_QUERY_TYPE (but not their combination).
component - a component on which the query is performed
Returns:
a task performing the query.

getAutoQueryTypes

public int getAutoQueryTypes(JTextComponent component,
                             String typedText)
Called by the code completion infrastructure to check whether a text just typed into a text component triggers an automatic query invocation.
If the particular query type is returned the infrastructure will then call createTask(int, JTextComponent).

Parameters:
component - a component in which typing appeared
typedText - a typed text
Returns:
a combination of the COMPLETION_QUERY_TYPE, DOCUMENTATION_QUERY_TYPE, and TOOLTIP_QUERY_TYPE values, or zero if no query should be automatically invoked.

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.