Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * 12/21/2008
   * - Base class for possible completions.
   * Copyright (C) 2008 Robert Futrell
   * robert_futrell at
   * 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
  * 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;
Base class for possible completions. Most, if not all, Completion implementations can extend this class. It remembers the CompletionProvider that returns this completion, and also implements Comparable, allowing such completions to be compared lexicographically (ignoring case).

This implementation assumes the input text and replacement text are the same value. It also returns the input text from its toString() method (which is what DefaultListCellRenderer uses to render objects). Subclasses that wish to override any of this behavior can simply override the corresponding method(s) needed to do so.

Robert Futrell
 public abstract class AbstractCompletion implements CompletionComparable {

The provider that created this completion;

provider The provider that created this completion.
 	public AbstractCompletion(CompletionProvider provider) {
 		this. = provider;

Compares this completion to another one lexicographically, ignoring case.

o Another completion instance.
How this completion compares to the other one.
 	public int compareTo(Object o) {
 		if (o==this) {
 			return 0;
 		else if (o instanceof Completion) {
 			Completion c2 = (Completion)o;
 		return -1;


Returns the text the user has to (start) typing for this completion to be offered. The default implementation simply returns Completion.getReplacementText().

The text the user has to (start) typing for this completion.
See also:
 	public String getInputText() {
 		return getReplacementText();

		return ;

The default implementation returns null. Subclasses can override this method.

The tool tip text.
	public String getToolTipText() {
		return null;

Returns a string representation of this completion. The default implementation returns getInputText().

A string representation of this completion.
	public String toString() {
		return getInputText();
New to GrepCode? Check out our FAQ X