|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.editor.AbstractCodeEditorIntelliHints
public abstract class AbstractCodeEditorIntelliHints
AbstractCodeEditorIntelliHints
is an abstract implementation of IntelliHints
for
CodeEditor
. It covers functions such as showing the hint popup at the correct position,
delegating keystrokes, updating and selecting hint. The only thing that is left out to subclasses is the creation of
the hint popup.
Field Summary |
---|
Fields inherited from interface com.jidesoft.hints.IntelliHints |
---|
CLIENT_PROPERTY_INTELLI_HINTS |
Constructor Summary | |
---|---|
AbstractCodeEditorIntelliHints(CodeEditor codeEditor)
Creates an IntelliHints object for a given JTextComponent. |
Method Summary | |
---|---|
void |
acceptHint(Object selected)
After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint. |
void |
addShowHintsKeyStroke(KeyStroke keyStroke)
Adds a new key stroke to show hints popup. |
protected JidePopup |
createPopup()
Creates a popup. |
KeyStroke[] |
getAllShowHintsKeyStrokes()
Gets all key strokes that will show hints popup. |
protected Rectangle |
getCaretRectangleForPopup()
Gets the caret rectangle where caret is displayed. |
CodeEditor |
getCodeEditor()
Gets the CodeEditor instance which use this class. |
protected Object |
getContext()
Gets the context for hints. |
abstract JComponent |
getDelegateComponent()
Gets the delegate component. |
abstract KeyStroke[] |
getDelegateKeyStrokes()
Gets the delegate keystrokes. |
String |
getDelimiters()
Gets the delimiters that is recognized by AbstractCodeEditorIntelliHints. |
static AbstractCodeEditorIntelliHints |
getIntelliHints(JComponent component)
Gets the IntelliHints object if it was installed on the component before. |
protected KeyStroke |
getShowHintsKeyStroke()
Gets the default keystroke that will trigger the hint popup. |
protected void |
hideHintsPopup()
Hides the hints popup. |
void |
install(CodeEditor editor)
Install the IntelliHints to the code editor. |
boolean |
isAutoPopup()
Returns whether the hints popup is automatically displayed. |
boolean |
isHintsPopupVisible()
Checks if the hints popup is visible. |
void |
removeShowHintsKeyStroke(KeyStroke keyStroke)
Removes a key stroke from the list to show hints popup. |
void |
setAutoPopup(boolean autoPopup)
Sets whether the popup should be displayed automatically. |
void |
setDelimiters(String delimiters)
Gets the delimiters that is recognized by AbstractCodeEditorIntelliHints. |
void |
setHintsEnabled(boolean enabled)
Enables or disables the hints popup. |
protected void |
showHintsPopup()
Shows the hints popup which contains the hints. |
void |
uninstall()
Uninstalls the IntelliHints. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jidesoft.hints.IntelliHints |
---|
createHintsComponent, getSelectedHint, updateHints |
Constructor Detail |
---|
public AbstractCodeEditorIntelliHints(CodeEditor codeEditor)
codeEditor
- the text component.Method Detail |
---|
public void install(CodeEditor editor)
editor
- the code editorpublic void uninstall()
protected JidePopup createPopup()
public CodeEditor getCodeEditor()
public void acceptHint(Object selected)
FileIntelliHints
will append the
selected item at the end of the existing text in order to complete a full file path.
acceptHint
in interface IntelliHints
selected
- the hint to be accepted.protected void showHintsPopup()
IntelliHints.updateHints(Object)
. Only if it returns
true, the popup will be shown.
protected Rectangle getCaretRectangleForPopup() throws BadLocationException
BadLocationException
- if the given position does not represent a valid location in the associated
document.protected Object getContext()
We provide a default context in AbstractIntelliHints. If it's a JTextArea, the context will be the string at the caret line from line beginning to the caret position. If it's a JTextField, the context will be whatever string in the text field. Subclass can always override it to return the context that is appropriate.
protected void hideHintsPopup()
public void setHintsEnabled(boolean enabled)
enabled
- true to enable the hints popup. Otherwise false.public boolean isHintsPopupVisible()
public boolean isAutoPopup()
setAutoPopup(boolean)
public void setAutoPopup(boolean autoPopup)
autoPopup
- true or falsepublic abstract KeyStroke[] getDelegateKeyStrokes()
getDelegateComponent()
.
getDelegateComponent()
when hint popup is
shown.public abstract JComponent getDelegateComponent()
protected KeyStroke getShowHintsKeyStroke()
public void addShowHintsKeyStroke(KeyStroke keyStroke)
keyStroke
- the key strokeremoveShowHintsKeyStroke(javax.swing.KeyStroke)
,
getAllShowHintsKeyStrokes()
public void removeShowHintsKeyStroke(KeyStroke keyStroke)
keyStroke
- the key strokepublic KeyStroke[] getAllShowHintsKeyStrokes()
public String getDelimiters()
setDelimiters(String)
public void setDelimiters(String delimiters)
delimiters
- the delimiterspublic static AbstractCodeEditorIntelliHints getIntelliHints(JComponent component)
component
- the component that has IntelliHints installed
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |