org.eclipse.jface.text.contentassist.IContextInformationExtension Java Examples

The following examples show how to use org.eclipse.jface.text.contentassist.IContextInformationExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextInformationPopup.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: JSContextInformationValidator.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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;
	}
}