use of org.eclipse.xtext.ui.editor.quickfix.QuickAssistInvocationContext in project xtext-eclipse by eclipse.
the class AnnotationWithQuickFixesHover method getHoverInfoInternal.
// DIFF: this code is entirely different, as the hover subclasses from AbstractProblemHover and
// hooks different methods
@Override
protected Object getHoverInfoInternal(ITextViewer textViewer, final int lineNumber, final int offset) {
AnnotationInfo result = recentAnnotationInfo;
if (result != null)
return result;
List<Annotation> annotations = getAnnotations(lineNumber, offset);
if (annotations != null) {
for (Annotation annotation : annotations) {
Position position = getAnnotationModel().getPosition(annotation);
if (annotation.getText() != null && position != null) {
final QuickAssistInvocationContext invocationContext = new QuickAssistInvocationContext(sourceViewer, position.getOffset(), position.getLength(), true);
CompletionProposalRunnable runnable = new CompletionProposalRunnable(invocationContext);
// Note: the resolutions have to be retrieved from the UI thread, otherwise
// workbench.getActiveWorkbenchWindow() will return null in LanguageSpecificURIEditorOpener and
// cause an exception
Display.getDefault().syncExec(runnable);
if (invocationContext.isMarkedCancelled()) {
return null;
}
result = new AnnotationInfo(annotation, position, sourceViewer, runnable.proposals);
recentAnnotationInfo = result;
return result;
}
}
}
return null;
}
Aggregations