by Pylo » Fri Mar 16, 2012 7:31 pm
Popup hides when you type more than three characters of any type. I'm using DefaultCompletitionProvider, VariableCompletition and FunctionCompletition. I've programmed code, that loads functions and variables using reflection to DefaultCompletitionProvider. Than code adds descpription based on JavaDOC. I've also made new CellRender for JList, that uses icons for function and variable completition. Here i'll post parts of my code:
Implementation of completition provider:
AutoCompletion ac = new AutoCompletion(provider);
ac.setShowDescWindow(true);
ac.setAutoCompleteSingleChoices(false);
ac.setParameterAssistanceEnabled(true);
ac.setListCellRenderer(new JavaCellRenderer());
ac.install(textArea);
Than I add completitions to DefaultCompletitionProvider dinamicly (when yout type ".", it loads all functions and add them to DefaultCompletitionProvider - old completitions are removed):
provider.clear();
for(int i = 0; i<meth.length; i++){
Method method = (Method) meth[i];
FunctionCompletion fc = new FunctionCompletion(provider, method.getName(), method.getReturnType().getSimpleName());
fc.setShortDescription(DOCParser.getDesc(method.getDeclaringClass().getName(), method.getName()));
ArrayList list = new ArrayList();
Class[] clas = method.getParameterTypes();
if(clas.length>-1)
for(int is = 0; is<clas.length; is++){
list.add(new ParameterizedCompletion.Parameter(clas[is].getSimpleName(), ""));
}
fc.setParams(list);
provider.addCompletion(fc);
}
Problem is, because three characters are in word "set", so if you want to get AutoCompletition for example "setSize", you type "set" and popup disappears, so you can't use AutoCompletition for functions with name, longer than three characters .