public class JythonCompletionTask extends java.lang.Object implements CompletionTask
JythonCompletionProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
__CLASSTYPE |
static java.lang.String |
CLIENT_PROPERTY_INTERPRETER_PROVIDER |
static java.lang.String |
CLIENT_PROPERTY_PWD |
Constructor and Description |
---|
JythonCompletionTask(javax.swing.text.JTextComponent t)
create the completion task on the text component, using its content and caret position.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Called by the code completion infrastructure to cancel the task.
|
int |
doQuery(CompletionContext cc,
CompletionResultSet resultSet)
perform the completions query.
|
static java.lang.String |
escapeHtml(java.lang.String s) |
static javax.swing.ImageIcon |
getIconFor(java.lang.Object jm)
return an identifying icon for the object, or null.
|
static int |
getImportableCompletions(java.lang.String source,
CompletionContext cc,
CompletionResultSet result)
get completions by looking at importLookup.jy, which is a list of commonly imported codes.
|
static java.lang.String |
getLastLine(java.lang.String script) |
static java.util.List<DefaultCompletionItem> |
getLocalsCompletions(PythonInterpreter interp,
CompletionContext cc)
get the list of available names at this point in the code.
|
static int |
getLocalsCompletions(PythonInterpreter interp,
CompletionContext cc,
CompletionResultSet rs)
get the locals completions, populating the result set
|
static <T extends java.lang.Comparable<T>> |
keySort(java.util.List<T> key,
java.util.List<?>... lists)
sorts all the lists by the first list.
|
void |
query(CompletionResultSet arg0)
Called by the code completion infrastructure to ask the task
to do a query and return the results through the given completion listener.
|
static void |
reduceObject(java.util.List<java.lang.String> signatures,
java.util.List<java.lang.String> labels,
java.util.List<java.lang.String> argss) |
void |
refresh(CompletionResultSet arg0)
Called by the code completion infrastructure to inform the task about
changes in the corresponding document.
|
static java.lang.String |
trimLinesToMakeValid(java.lang.String script)
introduced to see if we can pop a little code from the end, in case we
are within a triple-quoted string.
|
public static final java.lang.String CLIENT_PROPERTY_INTERPRETER_PROVIDER
public static final java.lang.String CLIENT_PROPERTY_PWD
public static final java.lang.String __CLASSTYPE
public JythonCompletionTask(javax.swing.text.JTextComponent t)
t
- the text componentpublic void query(CompletionResultSet arg0) throws PyException
CompletionTask
This method is always called in AWT thread but it may reschedule its processing into another thread and fire the given listener once the computing is finished.
query
in interface CompletionTask
arg0
- non-null result set to which the results
of the query must be added.PyException
public int doQuery(CompletionContext cc, CompletionResultSet resultSet)
cc
- resultSet
- public static java.lang.String getLastLine(java.lang.String script)
public static java.lang.String trimLinesToMakeValid(java.lang.String script)
script
- the scriptSimplifyScriptSupport.alligatorParse(java.lang.String)
public void refresh(CompletionResultSet arg0)
CompletionTask
query()
was invoked
but it may also be invoked BEFORE the query()
in case
the user types even before the query()
was called by the infrastructure. In such
case the resultSet
parameter will be null
.
query()
or refresh()
.
This method is always called in AWT thread but it may reschedule its processing into another thread and fire the given listener once the computing is finished.
refresh
in interface CompletionTask
arg0
- non-null result set to which the results
of the refreshing must be added.
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.public void cancel()
CompletionTask
This method may potentially be called from any thread.
cancel
in interface CompletionTask
public static int getLocalsCompletions(PythonInterpreter interp, CompletionContext cc, CompletionResultSet rs)
interp
- the interpretercc
- the completion contextrs
- the result set object which will contain the completions#getLocalsCompletions(org.python.util.PythonInterpreter, org.das2.jythoncompletion.CompletionContext)
public static int getImportableCompletions(java.lang.String source, CompletionContext cc, CompletionResultSet result)
source
- the script source.cc
- result
- public static java.lang.String escapeHtml(java.lang.String s)
public static <T extends java.lang.Comparable<T>> void keySort(java.util.List<T> key, java.util.List<?>... lists)
T
- the list typekey
- the list used to sortlists
- the lists to be sorted, often containing the key as well.public static void reduceObject(java.util.List<java.lang.String> signatures, java.util.List<java.lang.String> labels, java.util.List<java.lang.String> argss)
public static java.util.List<DefaultCompletionItem> getLocalsCompletions(PythonInterpreter interp, CompletionContext cc)
interp
- the interpretercc
- the completion contextpublic static javax.swing.ImageIcon getIconFor(java.lang.Object jm)
jm
- java.lang.reflect.Method, or PyInteger, etc.