if (codeContext != null) {
List<Node> units = codeContext.getCompletionsForString(line, prefix, linenumber);
for (Node unit : units) {
IContextInformation info = new ContextInformation(unit.getDocumentation(),
unit.getDocumentation());
int prefix_len = prefix.lastIndexOf('.');
if (unit.getInsertionText() != null) {
int len = unit.getInsertionText().length();
if (len > 0) {
results.add(new CompletionProposal(unit.getInsertionText(), offset, 0,
unit.getInsertionText().length() - 1, getImage(unit), unit.getName(), info,
unit.getDocumentation()));
}
}
}
} else {
// The following is a simple place holder for a more complex
// completion
Keywords[] values = Keywords.values();
for (int i = 0; i < values.length; i++) {
String keyword = values[i].getValue();
if (keyword.startsWith(prefix)) {
IContextInformation info = new ContextInformation(keyword, "XXX");
//MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.Proposal.ContextInfo.pattern"), new Object[] { fgProposals[i] })); //$NON-NLS-1$
results.add(new CompletionProposal(keyword.substring(prefix.length(), keyword.length())
+ " ", offset, 0, keyword.length() - prefix.length() + 1, go, keyword, info,
values[i].getDescription()));
}