org.netbeans.modules.editor.completion/1 1.6.22

org.netbeans.spi.editor.completion.support
Class AsyncCompletionTask

java.lang.Object
  extended by org.netbeans.spi.editor.completion.support.AsyncCompletionTask
All Implemented Interfaces:
Runnable, CompletionTask

public final class AsyncCompletionTask
extends Object
implements CompletionTask, Runnable

Asynchronous completion task allowing asynchronous query execution through AsyncCompletionQuery.
This is a final class and all the logic must be defined in an implementation of AsyncCompletionQuery that must be passed to constructor of this task.

See Also:
AsyncCompletionQuery

Constructor Summary
AsyncCompletionTask(AsyncCompletionQuery query)
          Constructor for the case when there is no valid component which can happen when creating task for documentation or tooltip computation.
AsyncCompletionTask(AsyncCompletionQuery query, JTextComponent component)
          Construct asynchronous task for the given component.
 
Method Summary
 void cancel()
          Called by completion infrastructure to cancel the running task.
 void query(CompletionResultSet resultSet)
          Called by completion infrastructure in AWT thread to populate the given result set with data.
 void refresh(CompletionResultSet resultSet)
          Called by completion infrastructure in AWT thread once there is a change in the component (caret position changes or document gets modified).
 void run()
          This method will be run() from the RequestProcessor during performing of the query.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsyncCompletionTask

public AsyncCompletionTask(AsyncCompletionQuery query,
                           JTextComponent component)
Construct asynchronous task for the given component.

Parameters:
query - non-null query implementation.
component - text component to operate with. The completion infrastructure will cancel the task if the component or its associated document would change.
It may be null to indicate that no component was provided.

AsyncCompletionTask

public AsyncCompletionTask(AsyncCompletionQuery query)
Constructor for the case when there is no valid component which can happen when creating task for documentation or tooltip computation.

Parameters:
query - non-null query implementation.
Method Detail

query

public void query(CompletionResultSet resultSet)
Called by completion infrastructure in AWT thread to populate the given result set with data.

Specified by:
query in interface CompletionTask
Parameters:
resultSet - non-null result set to which the results of the query must be added.

refresh

public void refresh(CompletionResultSet resultSet)
Called by completion infrastructure in AWT thread once there is a change in the component (caret position changes or document gets modified).
The results should be fired into the newly provided completion listener.

Specified by:
refresh in interface CompletionTask
Parameters:
resultSet - non-null result set to which the results of the refreshing must be added.
Null result set may be passed in case the query() was not invoked yet and user has typed a character. In this case the provider may hide the completion by using Completion.get().hideAll() if the typed character is inappropriate e.g. ";" for java completion.

cancel

public void cancel()
Called by completion infrastructure to cancel the running task.

Specified by:
cancel in interface CompletionTask

run

public void run()
This method will be run() from the RequestProcessor during performing of the query.

Specified by:
run in interface Runnable

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.editor.completion/1 1.6.22

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