Search in sources :

Example 1 with ICompletionProposalExtension3

use of org.eclipse.jface.text.contentassist.ICompletionProposalExtension3 in project eclipse.platform.text by eclipse.

the class AdditionalInfoController2 method computeInformation.

@Override
protected void computeInformation() {
    if (fProposalTable == null || fProposalTable.isDisposed())
        return;
    TableItem[] selection = fProposalTable.getSelection();
    if (selection != null && selection.length > 0) {
        TableItem item = selection[0];
        // compute information
        String information = null;
        Object d = item.getData();
        if (d instanceof ICompletionProposal) {
            ICompletionProposal p = (ICompletionProposal) d;
            information = p.getAdditionalProposalInfo();
        }
        if (d instanceof ICompletionProposalExtension3)
            setCustomInformationControlCreator(((ICompletionProposalExtension3) d).getInformationControlCreator());
        else
            setCustomInformationControlCreator(null);
        // compute subject area
        setMargins(4, -1);
        Rectangle area = fProposalTable.getBounds();
        // subject area is the whole subject control
        area.x = 0;
        area.y = 0;
        // set information & subject area
        setInformation(information, area);
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) Rectangle(org.eclipse.swt.graphics.Rectangle) ICompletionProposalExtension3(org.eclipse.jface.text.contentassist.ICompletionProposalExtension3)

Example 2 with ICompletionProposalExtension3

use of org.eclipse.jface.text.contentassist.ICompletionProposalExtension3 in project webtools.sourceediting by eclipse.

the class JSPCompletionProposal method getInformationControlCreator.

/*
	 * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getInformationControlCreator()
	 */
public IInformationControlCreator getInformationControlCreator() {
    // [277530] Use the java proposal's information control creator
    ICompletionProposal javaProposal = getJavaCompletionProposal();
    IInformationControlCreator informationControlCreator = null;
    if (javaProposal instanceof ICompletionProposalExtension3)
        informationControlCreator = ((ICompletionProposalExtension3) javaProposal).getInformationControlCreator();
    return informationControlCreator;
}
Also used : IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) ICompletionProposalExtension3(org.eclipse.jface.text.contentassist.ICompletionProposalExtension3)

Aggregations

ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)2 ICompletionProposalExtension3 (org.eclipse.jface.text.contentassist.ICompletionProposalExtension3)2 IInformationControlCreator (org.eclipse.jface.text.IInformationControlCreator)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 TableItem (org.eclipse.swt.widgets.TableItem)1