sidekick
Class SideKickCompletion

java.lang.Object
  extended by sidekick.SideKickCompletion

public abstract class SideKickCompletion
extends java.lang.Object

A code completion instance.

This is a wrapper around a collection of possible completions, with callbacks for inserting and displaying the completions in a popup menu.

Since:
SideKick 0.3
Version:
$Id: SideKickCompletion.java 7616 2006-10-18 11:45:49Z hertzhaft $
Author:
Slava Pestov

Field Summary
protected  java.util.List items
           
protected  java.lang.String text
           
protected  org.gjt.sp.jedit.textarea.JEditTextArea textArea
           
protected  org.gjt.sp.jedit.View view
           
 
Constructor Summary
SideKickCompletion()
          Deprecated. Use the other constructor instead.
SideKickCompletion(org.gjt.sp.jedit.View view, java.lang.String text)
           
SideKickCompletion(org.gjt.sp.jedit.View view, java.lang.String text, java.util.List items)
           
SideKickCompletion(org.gjt.sp.jedit.View view, java.lang.String text, java.lang.Object[] items)
           
 
Method Summary
 java.lang.Object get(int index)
           
 java.lang.String getCompletionDescription(int index)
           
 javax.swing.ListCellRenderer getRenderer()
           
 int getTokenLength()
          The length of the text being completed (popup will be positioned there).
 boolean handleKeystroke(int selectedIndex, char keyChar)
           
 void insert(int index)
           
 boolean isCompletionSelectable(int index)
           
 int size()
           
 boolean updateInPlace(org.gjt.sp.jedit.EditPane editPane, int caret)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected org.gjt.sp.jedit.View view

textArea

protected org.gjt.sp.jedit.textarea.JEditTextArea textArea

text

protected java.lang.String text

items

protected java.util.List items
Constructor Detail

SideKickCompletion

public SideKickCompletion()
Deprecated. Use the other constructor instead.


SideKickCompletion

public SideKickCompletion(org.gjt.sp.jedit.View view,
                          java.lang.String text)
Since:
SideKick 0.3.2

SideKickCompletion

public SideKickCompletion(org.gjt.sp.jedit.View view,
                          java.lang.String text,
                          java.util.List items)
Parameters:
items - - a list of strings containing the possible completions.
Since:
SideKick 0.3.2

SideKickCompletion

public SideKickCompletion(org.gjt.sp.jedit.View view,
                          java.lang.String text,
                          java.lang.Object[] items)
Since:
SideKick 0.3.2
Method Detail

size

public int size()

get

public java.lang.Object get(int index)

getCompletionDescription

public java.lang.String getCompletionDescription(int index)

isCompletionSelectable

public boolean isCompletionSelectable(int index)

updateInPlace

public boolean updateInPlace(org.gjt.sp.jedit.EditPane editPane,
                             int caret)
Returns:
If this returns false, then we create a new completion object after user input.

getRenderer

public javax.swing.ListCellRenderer getRenderer()

insert

public void insert(int index)

getTokenLength

public int getTokenLength()
The length of the text being completed (popup will be positioned there).


handleKeystroke

public boolean handleKeystroke(int selectedIndex,
                               char keyChar)
Parameters:
selectedIndex - -1 if the popup is empty, otherwise the index of the selected completion.
keyChar - the character typed by the user.
Returns:
True if completion should continue, false otherwise.
Since:
SideKick 0.3.2