use of org.eclipse.jface.text.source.TextInvocationContext in project xtext-eclipse by eclipse.
the class SpellingQuickfixTest method computeQuickAssistProposals.
protected ICompletionProposal[] computeQuickAssistProposals(int offset) {
XtextSourceViewer sourceViewer = getSourceViewer();
XtextReconciler reconciler = (XtextReconciler) sourceViewer.getAdapter(IReconciler.class);
IReconcilingStrategyExtension reconcilingStrategyExtension = (IReconcilingStrategyExtension) reconciler.getReconcilingStrategy("");
reconcilingStrategyExtension.initialReconcile();
QuickAssistAssistant quickAssistAssistant = (QuickAssistAssistant) sourceViewer.getQuickAssistAssistant();
IQuickAssistProcessor quickAssistProcessor = quickAssistAssistant.getQuickAssistProcessor();
ICompletionProposal[] quickAssistProposals = quickAssistProcessor.computeQuickAssistProposals(new TextInvocationContext(sourceViewer, offset, -1));
return quickAssistProposals;
}
use of org.eclipse.jface.text.source.TextInvocationContext in project xtext-eclipse by eclipse.
the class AbstractQuickfixTest method computeQuickAssistProposals.
protected ICompletionProposal[] computeQuickAssistProposals(XtextEditor editor, int offset) {
IResourcesSetupUtil.waitForBuild();
XtextSourceViewer sourceViewer = (XtextSourceViewer) editor.getInternalSourceViewer();
QuickAssistAssistant quickAssistAssistant = (QuickAssistAssistant) sourceViewer.getQuickAssistAssistant();
IQuickAssistProcessor quickAssistProcessor = quickAssistAssistant.getQuickAssistProcessor();
ICompletionProposal[] quickAssistProposals = quickAssistProcessor.computeQuickAssistProposals(new TextInvocationContext(sourceViewer, offset, -1));
return quickAssistProposals;
}
use of org.eclipse.jface.text.source.TextInvocationContext in project eclipse.platform.text by eclipse.
the class SpellingCorrectionProcessor method computeQuickAssistProposals.
/*
* @see IContentAssistProcessor#computeCompletionProposals(ITextViewer, int)
*/
@Override
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) {
ISourceViewer viewer = quickAssistContext.getSourceViewer();
int documentOffset = quickAssistContext.getOffset();
int length = viewer != null ? viewer.getSelectedRange().y : -1;
TextInvocationContext context = new TextInvocationContext(viewer, documentOffset, length);
IAnnotationModel model = viewer.getAnnotationModel();
if (model == null)
return fgNoSuggestionsProposal;
List<ICompletionProposal> proposals = computeProposals(context, model);
if (proposals.isEmpty())
return fgNoSuggestionsProposal;
return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
Aggregations