public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
if(file == null){
return new ICompletionProposal[0];
}
try {
CompileResult result = JSPCompiler.compile(viewer.getDocument().get());
IJavaProject project = JavaCore.create(file.getProject());
if(project != null){
ICompilationUnit unit = HTMLUtil.getTemporaryCompilationUnit(project);
HTMLUtil.setContentsToCU(unit, result.toString());
CompletionProposalCollector collector = new CompletionProposalCollector(project);
int headerLength = result.getHeader().length();
unit.codeComplete(headerLength + offset,
collector, DefaultWorkingCopyOwner.PRIMARY);
IJavaCompletionProposal[] proposals = collector.getJavaCompletionProposals();
List<ICompletionProposal> list = new ArrayList<ICompletionProposal>();