本文整理汇总了Java中org.eclipse.jface.text.ITextHoverExtension2类的典型用法代码示例。如果您正苦于以下问题:Java ITextHoverExtension2类的具体用法?Java ITextHoverExtension2怎么用?Java ITextHoverExtension2使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ITextHoverExtension2类属于org.eclipse.jface.text包,在下文中一共展示了ITextHoverExtension2类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHoverInfo2
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
if (currentHover != null) {
if (currentHover instanceof ITextHoverExtension2)
return ((ITextHoverExtension2) currentHover).getHoverInfo2(textViewer, hoverRegion);
else {
return currentHover.getHoverInfo(textViewer, hoverRegion);
}
}
return null;
}
示例2: getHoverInfo2
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion)
{
if (activeTextHover != null)
{
Object info = null;
if (activeTextHover instanceof AbstractCommonTextHover)
{
AbstractCommonTextHover commonHover = (AbstractCommonTextHover) activeTextHover;
commonHover.setEditor(getEditor());
}
if (activeTextHover instanceof ITextHoverExtension2)
{
info = ((ITextHoverExtension2) activeTextHover).getHoverInfo2(textViewer, hoverRegion);
}
else
{
info = activeTextHover.getHoverInfo(textViewer, hoverRegion);
}
if (info != null)
{
return info;
}
}
String defaultInfo = super.getHoverInfo(textViewer, hoverRegion);
if (defaultInfo != null)
{
// wrap it in a SimpleTextHover so it will look the same as other hovers (i.e. use the theme colors,
// etc.)
return new SimpleTextHover(defaultInfo, null).getHoverInfo2(textViewer, hoverRegion);
}
return null;
}
示例3: getHoverRegion
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset)
{
activeTextHover = null;
List<TextHoverDescriptor> descriptors = getEnabledTextHoverDescriptors(textViewer, offset);
for (TextHoverDescriptor descriptor : descriptors)
{
ITextHover textHover = descriptor.createTextHover();
IRegion region = null;
if (textHover != null)
{
region = textHover.getHoverRegion(textViewer, offset);
}
if (region != null)
{
if (descriptors.size() > 1)
{
if (textHover instanceof ITextHoverExtension2)
{
if (((ITextHoverExtension2) textHover).getHoverInfo2(textViewer, region) == null)
{
continue;
}
}
else if (textHover.getHoverInfo(textViewer, region) == null)
{
continue;
}
}
activeTextHover = textHover;
return region;
}
}
return super.getHoverRegion(textViewer, offset);
}
示例4: getHoverInfo2
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
/**
* Returns the information which should be presented when a hover or persistent popup is shown
* for the specified hover region.
*
* @param textViewer the viewer on which the hover popup should be shown
* @param hoverRegion the text range in the viewer which is used to determine the hover display
* information
* @param forInformationProvider <code>true</code> iff the hover info is requested by the
* information presenter. In this case, the method only considers text hovers for
* which a proper IInformationControlCreator is available that can supply focusable
* and resizable information controls.
*
* @return the hover popup display information, or <code>null</code> if none available
*
* @see ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)
* @since 3.8
*/
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion, boolean forInformationProvider) {
checkTextHovers();
fBestHover= null;
if (fInstantiatedTextHovers == null)
return null;
for (Iterator<IJavaEditorTextHover> iterator= fInstantiatedTextHovers.iterator(); iterator.hasNext(); ) {
ITextHover hover= iterator.next();
if (hover == null)
continue;
if (hover instanceof ITextHoverExtension2) {
Object info= ((ITextHoverExtension2) hover).getHoverInfo2(textViewer, hoverRegion);
if (info != null && !(forInformationProvider && getInformationPresenterControlCreator(hover) == null)) {
fBestHover= hover;
return info;
}
} else {
String s= hover.getHoverInfo(textViewer, hoverRegion);
if (s != null && s.trim().length() > 0) {
fBestHover= hover;
return s;
}
}
}
return null;
}
示例5: getHoverInfo2
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
if (ensureHoverCreated()) {
if (fHover instanceof ITextHoverExtension2)
return ((ITextHoverExtension2) fHover).getHoverInfo2(textViewer, hoverRegion);
else
return fHover.getHoverInfo(textViewer, hoverRegion);
}
return null;
}
示例6: getHoverInfo
import org.eclipse.jface.text.ITextHoverExtension2; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public Object getHoverInfo(ISourceBuffer sourceBuffer, IRegion hoverRegion, ITextViewer textViewer) {
fDelegate = getDelegate();
if (fDelegate instanceof ITextHoverExtension2) {
return ((ITextHoverExtension2) fDelegate).getHoverInfo2(textViewer, hoverRegion);
}
// fall back to legacy method
if (fDelegate != null) {
return fDelegate.getHoverInfo(textViewer, hoverRegion);
}
return null;
}