下面列出了怎么用org.eclipse.jface.text.contentassist.ICompletionProposalExtension3的API类实例代码及写法,或者点击链接到github查看源代码。
protected void computeInformation()
{
if (fProposal instanceof ICompletionProposalExtension3)
{
setCustomInformationControlCreator(((ICompletionProposalExtension3) fProposal)
.getInformationControlCreator());
}
else
{
setCustomInformationControlCreator(null);
}
// compute subject area
Point size = fProposalTable.getShell().getSize();
// set information & subject area
setInformation(fInformation, new Rectangle(0, 0, size.x, size.y));
}
/**
* Extracts the replacement string from an <code>ICompletionProposal</code>. If <code>proposal</code> is a
* <code>ICompletionProposalExtension3</code>, its <code>getCompletionText</code> method is called, otherwise, the
* display string is used.
*
* @param proposal
* the proposal to extract the text from
* @return the proposals completion text
* @since 3.1
*/
private CharSequence getPrefixCompletion(ICompletionProposal proposal)
{
CharSequence insertion = null;
if (proposal instanceof ICompletionProposalExtension3)
{
insertion = ((ICompletionProposalExtension3) proposal).getPrefixCompletionText(
fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
}
if (insertion == null)
{
insertion = proposal.getDisplayString();
}
return insertion;
}
public IInformationControlCreator getInformationControlCreator() {
return ((ICompletionProposalExtension3) jdtProposal).getInformationControlCreator();
}
/**
* Extracts the completion offset of an <code>ICompletionProposal</code>. If <code>proposal</code> is a
* <code>ICompletionProposalExtension3</code>, its <code>getCompletionOffset</code> method is called, otherwise, the
* invocation offset of this popup is shown.
*
* @param proposal
* the proposal to extract the offset from
* @return the proposals completion offset, or <code>fInvocationOffset</code>
* @since 3.1
*/
private int getPrefixCompletionOffset(ICompletionProposal proposal)
{
if (proposal instanceof ICompletionProposalExtension3)
{
return ((ICompletionProposalExtension3) proposal).getPrefixCompletionStart(
fContentAssistSubjectControlAdapter.getDocument(), fFilterOffset);
}
return fInvocationOffset;
}