| org.netbeans.spi.editor.completion.CompletionItem
All known Subclasses: org.netbeans.lib.editor.codetemplates.CodeTemplateCompletionItem,
CompletionItem | public interface CompletionItem (Code) | | The interface representing a single item of the result list that can be displayed
in the completion popup.
author: Miloslav Metelka, Dusan Balek version: 1.01 |
Method Summary | |
CompletionTask | createDocumentationTask() Returns a task used to obtain a documentation associated with the item if there
is any. | CompletionTask | createToolTipTask() Returns a task used to obtain a tooltip hint associated with the item if there
is any. | void | defaultAction(JTextComponent component) Gets invoked when user presses VK_ENTER key
or when she double-clicks on this item with the mouse cursor. | CharSequence | getInsertPrefix() Returns a text used for finding of a longest common prefix
after the TAB gets pressed or when the completion is opened explicitly. | int | getPreferredWidth(Graphics g, Font defaultFont) 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 widthe.g. | int | getSortPriority() Returns the item's priority. | CharSequence | getSortText() Returns a text used to sort items alphabetically. | boolean | instantSubstitution(JTextComponent component) 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
CompletionItem.defaultAction(JTextComponent) if necessary.
This method gets invoked from AWT thread.
Parameters: component - non-null text component for which the completion was invoked. | void | processKeyEvent(KeyEvent evt) 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. | void | render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) Render this item into the given graphics. |
createDocumentationTask | CompletionTask createDocumentationTask()(Code) | | Returns a task used to obtain a documentation associated with the item if there
is any.
|
createToolTipTask | CompletionTask createToolTipTask()(Code) | | Returns a task used to obtain a tooltip hint associated with the item if there
is any.
|
defaultAction | void defaultAction(JTextComponent component)(Code) | | 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. |
getInsertPrefix | CharSequence getInsertPrefix()(Code) | | 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.
non-null character sequence containing the insert prefix. Returning an empty string will effectively disable the TAB completionas the longest common prefix will be empty. since: 1.4 |
getPreferredWidth | int getPreferredWidth(Graphics g, Font defaultFont)(Code) | | 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 widthe.g. getting of the font metrics. Parameters: defaultFont - default font used for rendering. |
getSortPriority | int getSortPriority()(Code) | | Returns the item's priority. A lower value means a lower index of the item
in the completion result list.
|
getSortText | CharSequence getSortText()(Code) | | Returns a text used to sort items alphabetically.
|
instantSubstitution | boolean instantSubstitution(JTextComponent component)(Code) | | 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
CompletionItem.defaultAction(JTextComponent) if necessary.
This method gets invoked from AWT thread.
Parameters: component - non-null text component for which the completion was invoked. true if the instant substitution was successfully done.false means that the instant substitution should not be donefor this item and the completion item should normally be displayed. |
processKeyEvent | void processKeyEvent(KeyEvent evt)(Code) | | 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 consumedin case the item is sensitive to the given key. The source of this event is the text component to which the corresponding action shouldbe performed. |
render | void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected)(Code) | | Render this item into the given graphics.
Parameters: g - graphics to render the item into. Parameters: defaultFont - default font used for rendering. Parameters: defaultColor - default color used for rendering. Parameters: backgroundColor - color used for background. Parameters: width - width of the area to render into. Parameters: height - height of the are to render into. Parameters: selected - whether this item is visually selected in the listinto which the items are being rendered. |
|
|