edu.rice.cs.drjava.ui
Class AutoCompletePopup

java.lang.Object
  extended by edu.rice.cs.drjava.ui.AutoCompletePopup

public class AutoCompletePopup
extends Object

Autocomplete support.

Version:
$Id: AutoCompletePopup.java 5245 2010-05-07 02:59:04Z mgricken $

Field Summary
protected  Set<MainFrameStatics.AutoCompletePopupEntry> _allEntries
          Complete set of entries.
protected  Set<MainFrameStatics.AutoCompletePopupEntry> _apiEntries
          Set of all the Java API classes.
(package private)  JCheckBox _completeJavaAPICheckbox
          Checkbox that controls whether Java API classes are included.
protected  Set<MainFrameStatics.AutoCompletePopupEntry> _docEntries
          Set of the document entries.
protected  PredictiveInputFrame.FrameState _lastState
          Frame state.
protected  MainFrame _mainFrame
          Main frame.
 
Constructor Summary
AutoCompletePopup(MainFrame mf)
          Constructor for an auto-complete popup that uses the MainFrame for information.
AutoCompletePopup(MainFrame mf, String frameState)
          Constructor for an auto-complete popup that uses the MainFrame for information.
 
Method Summary
private  void addJavaAPI()
           
protected  PredictiveInputFrame<MainFrameStatics.AutoCompletePopupEntry> createCompleteWordDialog(String title, int start, int loc, SizedIterable<String> actionNames, SizedIterable<KeyStroke> actionKeyStrokes, Runnable canceledAction, SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)
           
 PredictiveInputFrame.FrameState getFrameState()
          Returns the last state of the frame, i.e.
private  void removeJavaAPI()
           
 void setFrameState(PredictiveInputFrame.FrameState ds)
          Sets state of the frame, i.e.
 void setFrameState(String s)
          Sets state of the frame, i.e.
 void show(Component parent, String title, String initial, int loc, Runnable canceledAction, Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer> acceptedAction)
          Display an auto-complete popup with the specified window title centered around the parent component.
 void show(Component parent, String title, String initial, int loc, SizedIterable<String> actionNames, Runnable canceledAction, SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)
          Display an auto-complete popup with the specified window title centered around the parent component.
 void show(Component parent, String title, String initial, int loc, SizedIterable<String> actionNames, SizedIterable<KeyStroke> actionKeyStrokes, int oneMatchActionIndex, Runnable canceledAction, SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)
          Display an auto-complete popup with the specified window title centered around the parent component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mainFrame

protected final MainFrame _mainFrame
Main frame.


_completeJavaAPICheckbox

JCheckBox _completeJavaAPICheckbox
Checkbox that controls whether Java API classes are included.


_lastState

protected PredictiveInputFrame.FrameState _lastState
Frame state.


_allEntries

protected final Set<MainFrameStatics.AutoCompletePopupEntry> _allEntries
Complete set of entries.


_docEntries

protected final Set<MainFrameStatics.AutoCompletePopupEntry> _docEntries
Set of the document entries.


_apiEntries

protected final Set<MainFrameStatics.AutoCompletePopupEntry> _apiEntries
Set of all the Java API classes.

Constructor Detail

AutoCompletePopup

public AutoCompletePopup(MainFrame mf)
Constructor for an auto-complete popup that uses the MainFrame for information.

Parameters:
mf - main frame of DrJava

AutoCompletePopup

public AutoCompletePopup(MainFrame mf,
                         String frameState)
Constructor for an auto-complete popup that uses the MainFrame for information.

Parameters:
mf - main frame of DrJava
frameState - position and size of the dialog
Method Detail

show

public void show(Component parent,
                 String title,
                 String initial,
                 int loc,
                 Runnable canceledAction,
                 Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer> acceptedAction)
Display an auto-complete popup with the specified window title centered around the parent component. The initial text and caret location are specified, as well as the action to be performed if the popup is cancelled or accepted.

Parameters:
parent - parent GUI component
title - window title
initial - initial text
loc - caret location in the initial text
canceledAction - action to take if canceled
acceptedAction - action to take if accepted

show

public void show(Component parent,
                 String title,
                 String initial,
                 int loc,
                 SizedIterable<String> actionNames,
                 Runnable canceledAction,
                 SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)
Display an auto-complete popup with the specified window title centered around the parent component. The initial text and caret location are specified, as well as the action to be performed if the popup is cancelled or accepted.

Parameters:
parent - parent GUI component
title - window title
initial - initial text
loc - caret location in the initial text
actionNames - names for the actions
canceledAction - action to take if canceled
acceptedActions - actions to take if accepted

show

public void show(Component parent,
                 String title,
                 String initial,
                 int loc,
                 SizedIterable<String> actionNames,
                 SizedIterable<KeyStroke> actionKeyStrokes,
                 int oneMatchActionIndex,
                 Runnable canceledAction,
                 SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)
Display an auto-complete popup with the specified window title centered around the parent component. The initial text and caret location are specified, as well as the action to be performed if the popup is cancelled or accepted.

Parameters:
parent - parent GUI component
title - window title
initial - initial text
loc - caret location in the initial text
actionNames - names for the actions
actionKeyStrokes - keystrokes for the actions
oneMatchActionIndex - the action to take when there's just one match, or -1
canceledAction - action to take if canceled
acceptedActions - actions to take if accepted

getFrameState

public PredictiveInputFrame.FrameState getFrameState()
Returns the last state of the frame, i.e. the location and dimension.

Returns:
frame state

setFrameState

public void setFrameState(PredictiveInputFrame.FrameState ds)
Sets state of the frame, i.e. the location and dimension of the frame for the next use.

Parameters:
ds - State to update to, or null to reset

setFrameState

public void setFrameState(String s)
Sets state of the frame, i.e. the location and dimension of the frame for the next use.

Parameters:
s - State to update to, or null to reset

createCompleteWordDialog

protected PredictiveInputFrame<MainFrameStatics.AutoCompletePopupEntry> createCompleteWordDialog(String title,
                                                                                                 int start,
                                                                                                 int loc,
                                                                                                 SizedIterable<String> actionNames,
                                                                                                 SizedIterable<KeyStroke> actionKeyStrokes,
                                                                                                 Runnable canceledAction,
                                                                                                 SizedIterable<Runnable3<MainFrameStatics.AutoCompletePopupEntry,Integer,Integer>> acceptedActions)

addJavaAPI

private void addJavaAPI()

removeJavaAPI

private void removeJavaAPI()