站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

CompletionQuery.DefaultResult (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor.ext
Class CompletionQuery.DefaultResult

java.lang.Object
  extended by org.netbeans.editor.ext.CompletionQuery.AbstractResult
      extended by 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


Constructor Summary
CompletionQuery.DefaultResult(JTextComponent component, String title, List data, int offset, int len)
          Constructor for DefaultResult
 
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 org.netbeans.editor.ext.CompletionQuery.AbstractResult
getData, getTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 window
data - 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.
Method Detail

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

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.