Java 类org.eclipse.jface.text.contentassist.IContextInformationExtension 实例源码

项目:APICloud-Studio    文件:ContextInformationPopup.java   
/**
 * Creates a context frame for the given offset.
 * 
 * @param information
 *            the context information
 * @param offset
 *            the offset
 * @return the created context frame
 * @since 3.0
 */
private ContextFrame createContextFrame(IContextInformation information, int offset)
{
    IContextInformationValidator validator = fContentAssistSubjectControlAdapter.getContextInformationValidator(
            fContentAssistant, offset);

    if (validator != null)
    {
        int beginOffset = (information instanceof IContextInformationExtension) ? ((IContextInformationExtension) information)
                .getContextInformationPosition() : offset;
        if (beginOffset == -1)
        {
            beginOffset = offset;
        }
        int visibleOffset = fContentAssistSubjectControlAdapter.getWidgetSelectionRange().x
                - (offset - beginOffset);
        IContextInformationPresenter presenter = fContentAssistSubjectControlAdapter
                .getContextInformationPresenter(fContentAssistant, offset);
        return new ContextFrame(information, beginOffset, offset, visibleOffset, validator, presenter);
    }

    return null;
}
项目:APICloud-Studio    文件:JSContextInformationValidator.java   
public void install(IContextInformation info, ITextViewer viewer, int offset)
{
    this._contextInformation = info;
    this._viewer = viewer;

    if (info instanceof IContextInformationExtension)
    {
        this._startingOffset = ((IContextInformationExtension) info).getContextInformationPosition();
    }
    else
    {
        this._startingOffset = offset;
    }
}