org.das2.jythoncompletion.support.CompletionItem
The interface representing a single item of the result list that can be displayed
in the completion popup.
createDocumentationTask
createDocumentationTask( ) → org.das2.jythoncompletion.support.CompletionTask
Returns a task used to obtain a documentation associated with the item if there
is any.
Returns:
org.das2.jythoncompletion.support.CompletionTask
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
createToolTipTask
createToolTipTask( ) → org.das2.jythoncompletion.support.CompletionTask
Returns a task used to obtain a tooltip hint associated with the item if there
is any.
Returns:
org.das2.jythoncompletion.support.CompletionTask
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
defaultAction
defaultAction( javax.swing.text.JTextComponent component ) → void
Gets invoked when user presses VK_ENTER
key
or when she double-clicks on this item with the mouse cursor.
This method gets invoked from AWT thread.
Parameters
component - non-null text component for which the completion was invoked.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getInsertPrefix
getInsertPrefix( ) → java.lang.CharSequence
Returns a text used for finding of a longest common prefix
after the TAB gets pressed or when the completion is opened explicitly.
The completion infrastructure will evaluate the insert prefixes
of all the items present in the visible result and finds the longest
common prefix.
Generally the returned text does not need to contain all the information
that gets inserted when the item is selected.
For example in java completion the field name should be returned for fields
or a method name for methods (but not parameters)
or a non-FQN name for classes.
Returns:
non-null character sequence containing the insert prefix.
Returning an empty string will effectively disable the TAB completion
as the longest common prefix will be empty.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getPreferredWidth
getPreferredWidth( java.awt.Graphics g, java.awt.Font defaultFont ) → int
Get the preferred visual width of this item.
The visual height of the item is fixed to 16 points.
Parameters
g - graphics that can be used for determining the preferred width
e.g. getting of the font metrics.
defaultFont - default font used for rendering.
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getSortPriority
getSortPriority( ) → int
Returns the item's priority. A lower value means a lower index of the item
in the completion result list.
Returns:
int
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getSortText
getSortText( ) → java.lang.CharSequence
Returns a text used to sort items alphabetically.
Returns:
java.lang.CharSequence
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
instantSubstitution
instantSubstitution( javax.swing.text.JTextComponent component ) → boolean
When enabled for the item the instant substitution should process the item
in the same way like when the item is displayed and Enter key gets pressed
by the user.
Instant substitution is invoked when there would be just a single item
displayed in the completion popup window.
The implementation can invoke the {@link #defaultAction(JTextComponent)}
if necessary.
This method gets invoked from AWT thread.
Parameters
component - non-null text component for which the completion was invoked.
Returns:
true
if the instant substitution was successfully done.
false
means that the instant substitution should not be done
for this item and the completion item should normally be displayed.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
processKeyEvent
processKeyEvent( java.awt.event.KeyEvent evt ) → void
Process the key pressed when this completion item was selected
in the completion popup window.
This method gets invoked from AWT thread.
Parameters
evt - non-null key event of the pressed key. It should be consumed
in case the item is sensitive to the given key. The source of this
event is the text component to which the corresponding action should
be performed.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
render
render( java.awt.Graphics g, java.awt.Font defaultFont, java.awt.Color defaultColor, java.awt.Color backgroundColor, int width, int height, boolean selected ) → void
Render this item into the given graphics.
Parameters
g - graphics to render the item into.
defaultFont - default font used for rendering.
defaultColor - default color used for rendering.
backgroundColor - color used for background.
width - width of the area to render into.
height - height of the are to render into.
selected - whether this item is visually selected in the list
into which the items are being rendered.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]