protected String[] resolveAll(TemplateContext context) {
ISourceModule module = ((ScriptTemplateContext) context)
.getSourceModule();
int offset = ((ScriptTemplateContext) context)
.getCompletionOffset();
CodeCompletionRequestor requestor = new CodeCompletionRequestor() {
@Override
public void accept(CompletionProposal proposal) {
if (isIgnored(proposal.getKind()))
return;
switch (proposal.getKind()) {
case CompletionProposal.TYPE_REF:
try {
if (!PHPFlags.isNamespace(((IType) proposal
.getModelElement()).getFlags())) {
addProposal(proposal);
}
} catch (ModelException e) {
}
break;
default:
break;
}
}
public ICompletionContext[] createContexts() {
return new ICompletionContext[] { new GlobalStatementContext() };
}
};
try {
module.codeComplete(offset, requestor, 1000);
} catch (ModelException e) {
PHPUiPlugin.log(e);
}
return requestor.getVariables();
}