当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
CompletionQuery.DefaultResult (Editor Library) - NetBeans API Javadoc (Current Development Version)
org.netbeans.editor.ext
Class CompletionQuery.DefaultResult
java.lang.Object
org.netbeans.editor.ext.CompletionQuery.AbstractResult
org.netbeans.editor.ext.CompletionQuery.DefaultResult
- All Implemented Interfaces:
- CompletionQuery.Result
- Enclosing interface:
- CompletionQuery
public static class CompletionQuery.DefaultResult
- extends CompletionQuery.AbstractResult
Full implementation of Result, managing substitution of the text and
finding and substituting common prefix of items
Method Summary |
boolean |
substituteCommonText(int dataIndex)
Update the text in response to pressing TAB key. |
boolean |
substituteText(int dataIndex,
boolean shift)
Update the text in response to pressing ENTER. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompletionQuery.DefaultResult
public CompletionQuery.DefaultResult(JTextComponent component,
String title,
List data,
int offset,
int len)
- Constructor for DefaultResult
- Parameters:
component
- the JTextComponent the result is tightened with,
used for operations on its Document, caret, selection and so.title
- the title displayed in header of completion windowdata
- the list of ResultItem instances to be displayed in
completion window, may be null.the
- offset in the document corresponding to the start
of the text occassionally replaced by the result.the
- length of the text to be replaced.
substituteCommonText
public boolean substituteCommonText(int dataIndex)
- Update the text in response to pressing TAB key. Searches through
all items of this result looking for longest common prefix and then
calls the substitution method on selected item providing it with
the length of common part.
- Parameters:
dataIndex
- current selected item index in the current data list.
Although normally it shouldn't be necessary for making
the substitution, the completion implementations
can use it for customized behavior.
- Returns:
- whether the text was successfully updated
substituteText
public boolean substituteText(int dataIndex,
boolean shift)
- Update the text in response to pressing ENTER.
- Parameters:
dataIndex
- current selected item index in the current data list.
It can be used for making the substitution.shift
- indicates request for some kind of different behaviour,
means that e.g. user hold shift while pressing ENTER.
- Returns:
- whether the text was successfully updated