use of org.eclipse.wst.sse.ui.internal.correction.QuickFixRegistry in project jbosstools-base by jbosstools.
the class MarkerAnnotationInfo method getProposals.
private List<ICompletionProposal> getProposals(TemporaryAnnotation annotation, Position position) {
List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
List<IQuickAssistProcessor> processors = new ArrayList<IQuickAssistProcessor>();
boolean isJBTAnnotation = isJBTAnnotation(annotation);
// get all relevant quick fixes for this annotation
if (QuickFixManager.getInstance().hasProposals(annotation, position)) {
if (annotation.getText().startsWith(UNKNOWN_TAG) || annotation.getText().startsWith(MISSING_ATTRIBUTE)) {
annotation.setAdditionalFixInfo(viewer.getDocument());
}
List<IJavaCompletionProposal> proposals = QuickFixManager.getInstance().getProposals(annotation, position);
allProposals.addAll(proposals);
}
if (!isJBTAnnotation) {
Object o = annotation.getAdditionalFixInfo();
if (o instanceof IQuickAssistProcessor) {
processors.add((IQuickAssistProcessor) o);
}
QuickFixRegistry registry = QuickFixRegistry.getInstance();
processors.addAll(Arrays.asList(registry.getQuickFixProcessors(annotation)));
// set up context
Map attributes = annotation.getAttributes();
StructuredTextInvocationContext sseContext = new StructuredTextInvocationContext(viewer, position.getOffset(), position.getLength(), attributes);
ICompletionProposal[] compoundQuickAssistProcessorProposals = fCompoundQuickAssistProcessor.computeQuickAssistProposals(sseContext);
if (compoundQuickAssistProcessorProposals != null) {
for (ICompletionProposal proposal : compoundQuickAssistProcessorProposals) {
allProposals.add(proposal);
}
}
// call each processor
for (int i = 0; i < processors.size(); ++i) {
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
collectProposals((IQuickAssistProcessor) processors.get(i), annotation, sseContext, proposals);
allProposals.addAll(proposals);
}
}
return allProposals;
}
Aggregations