public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset)
{
// ICompletionProposal[] result = new ICompletionProposal[1];
List<CompletionProposal> proposalsList = new ArrayList<CompletionProposal>();
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
if (this.partition.equals(IDjangoPartitions.DJANGO_TAG) ||
partition.equals(IDjangoPartitions.DJANGO_DEFAULT))
{
// iterate over tags
for (String key: IDjangoSyntax.TAGS) {
if (key.toLowerCase().startsWith(wordPart.getString().toLowerCase()))
proposalsList.add(createCompletionProposal(key, wordPart, "TAG"));
}
for (String key: IDjangoSyntax.END_TAGS) {
if (key.toLowerCase().startsWith(wordPart.getString().toLowerCase()))
proposalsList.add(createCompletionProposal(key, wordPart, "TAG"));
}
}
if (this.partition.equals(IDjangoPartitions.DJANGO_VARIABLE)) {
// iterate over filters
for (String key: IDjangoSyntax.FILTERS) {
if (key.toLowerCase().startsWith(wordPart.getString().toLowerCase()))
proposalsList.add(createCompletionProposal(key, wordPart, "FILTER"));
}
// iterate over forloop
for (String key: IDjangoSyntax.FORLOOP) {
if (key.toLowerCase().startsWith(wordPart.getString().toLowerCase()))
proposalsList.add(createCompletionProposal(key, wordPart, "FORLOOP"));
}
}
return proposalsList.toArray(new ICompletionProposal[0]);
}