@Override
protected ICompletionProposal[] getCompletionProposals(
CommandLine commandLine, String project, String file, int offset)
throws Exception
{
IContentAssistProcessor processor =
getContentAssistProcessor(commandLine, project, file);
IFile ifile = ProjectUtils.getFile(
ProjectUtils.getProject(project, true), file);
IStructuredModel model =
StructuredModelManager.getModelManager().getModelForRead(ifile);
if (model != null){
StructuredTextViewer viewer = new StructuredTextViewer(
EclimPlugin.getShell(), null, null, false, 0){
private Point point;
public Point getSelectedRange()
{
return point;
}
public void setSelectedRange(int x, int y)
{
point = new Point(x, y);
}
};
viewer.setDocument(model.getStructuredDocument());
// note: non-zero length can break html completion.
viewer.setSelectedRange(offset, 0);
ICompletionProposal[] proposals =
processor.computeCompletionProposals(viewer, offset);
model.releaseFromRead();
return proposals;
}
return new ICompletionProposal[0];
}