use of org.eclipse.jface.text.IEditingSupportRegistry in project eclipse.platform.text by eclipse.
the class CompletionProposalPopup method displayProposals.
/**
* Displays this popup and install the additional info controller, so that additional info
* is displayed when a proposal is selected and additional info is available.
*/
void displayProposals() {
if (!Helper.okToUse(fProposalShell) || !Helper.okToUse(fProposalTable))
return;
if (fContentAssistant.addContentAssistListener(this, ContentAssistant.PROPOSAL_SELECTOR)) {
ensureDocumentListenerInstalled();
if (fFocusHelper == null) {
fFocusHelper = new IEditingSupport() {
@Override
public boolean isOriginator(DocumentEvent event, IRegion focus) {
// this helper just covers the focus change to the proposal shell, no remote editions
return false;
}
@Override
public boolean ownsFocusShell() {
return true;
}
};
}
if (fViewer instanceof IEditingSupportRegistry) {
IEditingSupportRegistry registry = (IEditingSupportRegistry) fViewer;
registry.register(fFocusHelper);
}
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52646
* on GTK, setVisible and such may run the event loop
* (see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=47511)
* Since the user may have already canceled the popup or selected
* an entry (ESC or RETURN), we have to double check whether
* the table is still okToUse. See comments below
*/
// may run event loop on GTK
fProposalShell.setVisible(true);
// transfer focus since no verify key listener can be attached
if (!fContentAssistSubjectControlAdapter.supportsVerifyKeyListener() && Helper.okToUse(fProposalShell))
// may run event loop on GTK ??
fProposalShell.setFocus();
if (fAdditionalInfoController != null && Helper.okToUse(fProposalTable)) {
fAdditionalInfoController.install(fProposalTable);
fAdditionalInfoController.handleTableSelectionChanged();
}
} else
hide();
}
Aggregations