if (target != null)
target.beginCompoundChange();
if (viewer instanceof IEditingSupportRegistry) {
IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
registry.register(helper);
}
if (p instanceof ICompletionProposalExtension2 && viewer != null) {
ICompletionProposalExtension2 e= (ICompletionProposalExtension2) p;
e.apply(viewer, trigger, stateMask, offset);
} else if (p instanceof ICompletionProposalExtension) {
ICompletionProposalExtension e= (ICompletionProposalExtension) p;
e.apply(document, trigger, offset);
} else {
p.apply(document);
}
fireAppliedEvent(p);
TextSelection selection= p.getSelection(document);
if (selection != null) {
contentAssistSubjectControlAdapter.setSelectedRange(selection.offset, selection.length);
contentAssistSubjectControlAdapter.revealRange(selection.offset, selection.length);
}
IContextInformation info= p.getContextInformation();
if (info != null) {
int contextInformationOffset;
if (p instanceof ICompletionProposalExtension) {
ICompletionProposalExtension e= (ICompletionProposalExtension) p;
contextInformationOffset= e.getContextInformationPosition();
} else {
if (selection == null)
selection= contentAssistSubjectControlAdapter.getSelectedRange();
contextInformationOffset= selection.offset + selection.length;
}
contentAssistant.showContextInformation(info, contextInformationOffset);
} else
contentAssistant.showContextInformation(null, -1);
} finally {
if (target != null)
target.endCompoundChange();
if (viewer instanceof IEditingSupportRegistry) {
IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
registry.unregister(helper);
}
inserting= false;
}
}