@Override public void run() throws Exception { result[0]= p.computeCompletionProposals(viewer, offset); fLastErrorMessage= p.getErrorMessage(); } });
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { ICompletionProposal[] allProposals = null; for (IContentAssistProcessor delegate : delegates) { allProposals = merge(allProposals, delegate.computeCompletionProposals(viewer, offset)); } return allProposals; }
/** * Figures out what the correct ICompletionProposalProcessor is and * computesCompletionProposals on that. * * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, * int) */ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { IContentAssistProcessor p = null; ICompletionProposal[] results = EMPTY_PROPOSAL_SET; p = guessContentAssistProcessor(viewer, documentOffset); if (p != null) { results = p.computeCompletionProposals(viewer, documentOffset); } return (results != null) ? results : EMPTY_PROPOSAL_SET; }
protected ICompletionProposal[] computeCompletionProposals(final IXtextDocument xtextDocument, int cursorPosition, XtextSourceViewerConfiguration configuration, ISourceViewer sourceViewer) throws BadLocationException { IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer); String contentType = xtextDocument.getContentType(cursorPosition); IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(contentType); if (processor != null) { return processor.computeCompletionProposals(sourceViewer, cursorPosition); } return new ICompletionProposal[0]; }
public ICompletionProposal[] computeCompletionProposals(final String currentModelToParse, int cursorPosition) throws Exception { final XtextResource xtextResource = loadHelper.getResourceFor(new StringInputStream(currentModelToParse)); final IXtextDocument xtextDocument = getDocument(xtextResource, currentModelToParse); XtextSourceViewerConfiguration configuration = get(XtextSourceViewerConfiguration.class); Shell shell = new Shell(); try { ISourceViewer sourceViewer = getSourceViewer(shell, xtextDocument, configuration); IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer); String contentType = xtextDocument.getContentType(cursorPosition); IContentAssistProcessor processor = contentAssistant.getContentAssistProcessor(contentType); if (processor != null) { return processor.computeCompletionProposals(sourceViewer, cursorPosition); } return new ICompletionProposal[0]; } finally { shell.dispose(); } }