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

The following examples show how to use org.eclipse.jface.text.contentassist.IContextInformationPresenter. 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: ContextInformationPopup.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ContextFrame(IContextInformation information, int beginOffset, int offset, int visibleOffset,
		IContextInformationValidator validator, IContextInformationPresenter presenter)
{
	fInformation = information;
	fBeginOffset = beginOffset;
	fOffset = offset;
	fVisibleOffset = visibleOffset;
	fValidator = validator;
	fPresenter = presenter;
}
 
Example #3
Source File: SimpleAssistProcessor.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private ContextInformationDelegator(IContextInformationValidator defaultContextInformationValidator) {
    Assert.isTrue(defaultContextInformationValidator instanceof IContextInformationPresenter);
    this.defaultContextInformationValidator = defaultContextInformationValidator;
}
 
Example #4
Source File: SimpleAssistProcessor.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean updatePresentation(int offset, TextPresentation presentation) {
    return ((IContextInformationPresenter) defaultContextInformationValidator).updatePresentation(offset,
            presentation);
}
 
Example #5
Source File: ContentAssistSubjectControlAdapter.java    From APICloud-Studio with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns the context information presenter that should be used to display context information. The position is
 * used to determine the appropriate code assist processor to invoke.
 * 
 * @param contentAssistant
 *            the code assistant
 * @param offset
 *            a document offset
 * @return a presenter
 */
public IContextInformationPresenter getContextInformationPresenter(ContentAssistant contentAssistant, int offset)
{
	if (fContentAssistSubjectControl != null)
	{
		return contentAssistant.getContextInformationPresenter(fContentAssistSubjectControl, offset);
	}
	return contentAssistant.getContextInformationPresenter(fViewer, offset);
}
 
Example #6
Source File: ContentAssistant.java    From APICloud-Studio with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns the context information presenter that should be used to display context information. The position is
 * used to determine the appropriate code assist processor to invoke.
 * 
 * @param viewer
 *            the text viewer
 * @param offset
 *            a document offset
 * @return a presenter
 * @since 2.0
 */
IContextInformationPresenter getContextInformationPresenter(ITextViewer viewer, int offset)
{
	IContextInformationValidator validator = getContextInformationValidator(viewer, offset);
	if (validator instanceof IContextInformationPresenter)
	{
		return (IContextInformationPresenter) validator;
	}
	return null;
}
 
Example #7
Source File: ContentAssistant.java    From APICloud-Studio with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns the context information presenter that should be used to display context information. The position is
 * used to determine the appropriate code assist processor to invoke.
 * 
 * @param contentAssistSubjectControl
 *            the code assist subject control
 * @param offset
 *            a document offset
 * @return a presenter
 * @since 3.0
 */
IContextInformationPresenter getContextInformationPresenter(
		IContentAssistSubjectControl contentAssistSubjectControl, int offset)
{
	IContextInformationValidator validator = getContextInformationValidator(contentAssistSubjectControl, offset);
	if (validator instanceof IContextInformationPresenter)
	{
		return (IContextInformationPresenter) validator;
	}
	return null;
}