Java Code Examples for org.eclipse.jface.text.ITextHover#getHoverRegion()
The following examples show how to use
org.eclipse.jface.text.ITextHover#getHoverRegion() .
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: AbstractCompositeHover.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public IRegion getHoverRegion(ITextViewer textViewer, int offset) { if (getHovers() != null) { for (ITextHover hover : getHovers()) { IRegion region = hover.getHoverRegion(textViewer, offset); if (region != null) { // We always take the first that answers with a region // In org.eclipse.xtext.ui.editor.hover.DefaultCompositeHover.createHovers() the AnnotationWithQuickFixesHover // is always the first and answers with a region only when there is a problemmarker // In all other cases an instance of org.eclipse.xtext.ui.editor.hover.DispatchingEObjectTextHover is the next in the order. currentHover = hover; return region; } } } currentHover = null; return null; }
Example 2
Source File: CommonSourceViewerConfiguration.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
@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); }