Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 12/21/2008
   *
   * CompletionProvider.java - Provides autocompletion values based on the
   * text currently in a text component.
   * Copyright (C) 2008 Robert Futrell
   * robert_futrell at users.sourceforge.net
   * http://fifesoft.com/rsyntaxtextarea
   *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  */
 package org.fife.ui.autocomplete;
 
 import java.awt.Point;
 import java.util.List;
 
Provides autocompletion values to an AutoCompletion.

Completion providers can have an optional parent. Parents are searched for completions when their children are. This allows for chaining of completion providers.

Author(s):
Robert Futrell
Version:
1.0
 
 public interface CompletionProvider {


Clears the values used to identify and insert "parameterized completions" (e.g. functions or methods). After this method is called, functions and methods will not have their parameters auto-completed.

 
Returns the text just before the current caret position that could be the start of something auto-completable.

Parameters:
comp The text component.
Returns:
The text. A return value of null means nothing should be auto-completed; a value of an empty string ("") means auto-completion should still be considered (i.e., all possible choices are valid).
 
Gets the possible completions for the text component at the current caret position.

Parameters:
comp The text component.
Returns:
The list of Completions. If no completions are available, this may be null.
 
 	public List getCompletions(JTextComponent comp);


Returns the completions that have been entered at the specified visual location. This can be used for tool tips when the user hovers the mouse over completed text.

Parameters:
comp The text component.
p The position, usually from a MouseEvent.
Returns:
The completions, or an empty list if there are none.
 
 	public List getCompletionsAt(JTextComponent compPoint p);


Returns the cell renderer for completions returned from this provider.

Returns:
The cell renderer, or null if the default should be used.
See also:
setListCellRenderer(javax.swing.ListCellRenderer)
 
Returns a list of parameterized completions that have been entered at the current caret position of a text component (and thus can have their completion choices displayed).

Parameters:
tc The text component.
Returns:
The list of ParameterizedCompletions. If no completions are available, this may be null.
Returns the text that marks the end of a list of parameters to a function or method.

	public char getParameterListEnd();


Returns the text that separates parameters to a function or method.

Returns:
The text that separates parameters, for example, ", ".
See also:
getParameterListStart()
getParameterListEnd()
setParameterizedCompletionParams(char,java.lang.String,char)
Returns the text that marks the start of a list of parameters to a function or method.

Returns:
The text for a parameter list start, for example, "(".
See also:
getParameterListEnd()
getParameterListSeparator()
setParameterizedCompletionParams(char,java.lang.String,char)
	public char getParameterListStart();


Returns the parent completion provider.

Returns:
The parent completion provider.
See also:
setParent(org.fife.ui.autocomplete.CompletionProvider)
Sets the renderer to use when displaying completion choices.

Parameters:
r The renderer to use.
See also:
getListCellRenderer()
Sets the values used to identify and insert "parameterized completions" (e.g. functions or methods). If this method isn't called, functions and methods will not have their parameters auto-completed.

Parameters:
listStart The character that marks the beginning of a list of parameters, such as '(' in C or Java.
separator Text that should separate parameters in a parameter list when one is inserted. For example, ", ".
listEnd The character that marks the end of a list of parameters, such as ')' in C or Java.
Throws:
java.lang.IllegalArgumentException If either listStart or listEnd is not printable ASCII, or if separator is null or an empty string.
See also:
clearParameterizedCompletionParams()
	public void setParameterizedCompletionParams(char listStart,
										String separatorchar listEnd);


Sets the parent completion provider.

Parameters:
parent The parent provider. null means there will be no parent provider.
See also:
getParent()
	public void setParent(CompletionProvider parent);
New to GrepCode? Check out our FAQ X