Package org.kcc
Class KeywordBasedCodeCompletion
- java.lang.Object
-
- org.kcc.KeywordBasedCodeCompletion
-
public class KeywordBasedCodeCompletion extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private ContextSuggestionsNarrowerafterFilteringNarrowingprivate ContextSuggestionsNarrowerbeforeFilteringNarrowingprivate javax.swing.event.CaretListenercaretListenerToRemoveprivate booleandebugprivate java.awt.event.FocusListenerfocusListenerToRemoveprivate java.awt.PointfutureLocationprivate javax.swing.JFramehelpprivate java.awt.event.KeyListenerkeyListenerToRemoveprivate CompletionItem[]keywordsprivate java.util.regex.Patternnondelimiterprivate javax.swing.JFramepopupprivate javax.swing.JScrollPanescrollprivate CompletionSettingssettingsprivate javax.swing.JTextAreasourceprivate javax.swing.JLabelstatusLabelprivate javax.swing.JList<CompletionItem>suggested
-
Constructor Summary
Constructors Constructor Description KeywordBasedCodeCompletion(javax.swing.JTextArea source, CompletionSettings settings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidapply()private intcalcCompletionPosition()private javax.swing.JFramecreateFrame()private static javax.swing.ListModelcreateModel(CompletionItem[] listData)private voiddebugln(java.lang.String s)private voiddeductSize(javax.swing.JFrame ff)voiddispose()Needed to clean up all the listeners all the windows are disposed on every hide, so it is not mandatory for closing of generic applicationprivate voidende()private voidfilter(java.lang.String word, int caretpos)ContextSuggestionsNarrowergetAfterFilteringNarrowing()(package private) static java.lang.String[]getAfterLines(int afterContextLinesCount, int caretpos, java.lang.String text)ContextSuggestionsNarrowergetBeforeFilteringNarrowing()(package private) static java.lang.String[]getBeforeLines(int beforeContextLinesCount, int caretpos, java.lang.String word, java.lang.String text)private java.lang.StringgetLastWord(int caretpos)CompletionSettingsgetSettings()private voidproceed(javax.swing.event.CaretEvent caretEvent)private voidproceed(javax.swing.event.CaretEvent caretEvent, javax.swing.event.DocumentEvent documentEvent)private voidproceedArrow(java.awt.event.KeyEvent keyEvent)private voidremoveHelp()voidsetAfterFilteringNarrowing(ContextSuggestionsNarrower afterFilteringNarrowing)voidsetBeforeFilteringNarrowing(ContextSuggestionsNarrower beforeFilteringNarrowing)voidsetCompletionsSet(CompletionItem.CompletionItemSet set)private voidsetKeywords(CompletionItem[] keywords)private voidsetKeywordsImpl(CompletionItem[] lkeywords)private voidshowHelp()
-
-
-
Field Detail
-
source
private final javax.swing.JTextArea source
-
settings
private final CompletionSettings settings
-
statusLabel
private final javax.swing.JLabel statusLabel
-
nondelimiter
private java.util.regex.Pattern nondelimiter
-
keywords
private CompletionItem[] keywords
-
popup
private javax.swing.JFrame popup
-
help
private javax.swing.JFrame help
-
suggested
private final javax.swing.JList<CompletionItem> suggested
-
scroll
private final javax.swing.JScrollPane scroll
-
caretListenerToRemove
private final javax.swing.event.CaretListener caretListenerToRemove
-
keyListenerToRemove
private final java.awt.event.KeyListener keyListenerToRemove
-
focusListenerToRemove
private final java.awt.event.FocusListener focusListenerToRemove
-
debug
private boolean debug
-
futureLocation
private java.awt.Point futureLocation
-
afterFilteringNarrowing
private ContextSuggestionsNarrower afterFilteringNarrowing
-
beforeFilteringNarrowing
private ContextSuggestionsNarrower beforeFilteringNarrowing
-
-
Constructor Detail
-
KeywordBasedCodeCompletion
public KeywordBasedCodeCompletion(javax.swing.JTextArea source, CompletionSettings settings)
-
-
Method Detail
-
showHelp
private void showHelp()
-
createFrame
private javax.swing.JFrame createFrame()
-
setCompletionsSet
public void setCompletionsSet(CompletionItem.CompletionItemSet set)
-
proceedArrow
private void proceedArrow(java.awt.event.KeyEvent keyEvent)
-
ende
private void ende()
-
proceed
private void proceed(javax.swing.event.CaretEvent caretEvent)
-
proceed
private void proceed(javax.swing.event.CaretEvent caretEvent, javax.swing.event.DocumentEvent documentEvent)
-
getLastWord
private java.lang.String getLastWord(int caretpos)
-
filter
private void filter(java.lang.String word, int caretpos)
-
getAfterLines
static java.lang.String[] getAfterLines(int afterContextLinesCount, int caretpos, java.lang.String text)
-
getBeforeLines
static java.lang.String[] getBeforeLines(int beforeContextLinesCount, int caretpos, java.lang.String word, java.lang.String text)
-
calcCompletionPosition
private int calcCompletionPosition()
-
debugln
private void debugln(java.lang.String s)
-
createModel
private static javax.swing.ListModel createModel(CompletionItem[] listData)
-
setKeywords
private void setKeywords(CompletionItem[] keywords)
-
setKeywordsImpl
private void setKeywordsImpl(CompletionItem[] lkeywords)
-
deductSize
private void deductSize(javax.swing.JFrame ff)
-
apply
private void apply()
-
dispose
public void dispose()
Needed to clean up all the listeners all the windows are disposed on every hide, so it is not mandatory for closing of generic application
-
removeHelp
private void removeHelp()
-
getSettings
public CompletionSettings getSettings()
-
getBeforeFilteringNarrowing
public ContextSuggestionsNarrower getBeforeFilteringNarrowing()
-
getAfterFilteringNarrowing
public ContextSuggestionsNarrower getAfterFilteringNarrowing()
-
setBeforeFilteringNarrowing
public void setBeforeFilteringNarrowing(ContextSuggestionsNarrower beforeFilteringNarrowing)
-
setAfterFilteringNarrowing
public void setAfterFilteringNarrowing(ContextSuggestionsNarrower afterFilteringNarrowing)
-
-