use of org.eclipse.jface.text.ITextHover in project webtools.sourceediting by eclipse.
the class TestViewerConfigurationCSS method testGetTextHover.
/*
* not necessary
*/
public void testGetTextHover() {
// probably no display
if (!fDisplayExists)
return;
String[] hoverPartitions = new String[] { ICSSPartitions.STYLE };
for (int i = 0; i < hoverPartitions.length; i++) {
ITextHover hover = fConfig.getTextHover(fViewer, hoverPartitions[i], SWT.NONE);
assertNotNull("hover was null for partition: " + hoverPartitions[i], hover);
}
}
use of org.eclipse.jface.text.ITextHover in project webtools.sourceediting by eclipse.
the class TestViewerConfigurationJSP method testGetTextHover.
public void testGetTextHover() {
// probably no display
if (!fDisplayExists)
return;
String[] hoverPartitions = new String[] { IHTMLPartitions.HTML_DEFAULT, IHTMLPartitions.SCRIPT, IJSPPartitions.JSP_DEFAULT, IJSPPartitions.JSP_DIRECTIVE, IJSPPartitions.JSP_CONTENT_JAVA, IXMLPartitions.XML_DEFAULT };
for (int i = 0; i < hoverPartitions.length; i++) {
ITextHover hover = fConfig.getTextHover(fViewer, hoverPartitions[i], SWT.NONE);
assertNotNull("hover was null for partition: " + hoverPartitions[i], hover);
}
}
use of org.eclipse.jface.text.ITextHover in project webtools.sourceediting by eclipse.
the class TestViewerConfigurationXML method testGetTextHover.
public void testGetTextHover() {
// probably no display
if (!fDisplayExists)
return;
String[] hoverPartitions = new String[] { IStructuredPartitions.DEFAULT_PARTITION, IXMLPartitions.XML_DEFAULT };
for (int i = 0; i < hoverPartitions.length; i++) {
ITextHover hover = fConfig.getTextHover(fViewer, hoverPartitions[i], SWT.NONE);
assertNotNull("hover was null for partition: " + hoverPartitions[i], hover);
}
}
use of org.eclipse.jface.text.ITextHover in project webtools.sourceediting by eclipse.
the class StructuredTextEditor method updateHoverBehavior.
/*
* Update the hovering behavior depending on the preferences.
*/
private void updateHoverBehavior() {
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
String[] types = configuration.getConfiguredContentTypes(getSourceViewer());
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer == null)
return;
for (int i = 0; i < types.length; i++) {
String t = types[i];
if (sourceViewer instanceof ITextViewerExtension2) {
// Remove existing hovers
((ITextViewerExtension2) sourceViewer).removeTextHovers(t);
int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
if (stateMasks != null) {
for (int j = 0; j < stateMasks.length; j++) {
int stateMask = stateMasks[j];
ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
}
} else {
ITextHover textHover = configuration.getTextHover(sourceViewer, t);
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
} else
sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
}
}
use of org.eclipse.jface.text.ITextHover in project webtools.sourceediting by eclipse.
the class BestMatchHover method getHoverRegion.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer,
* int)
*/
public IRegion getHoverRegion(ITextViewer viewer, int offset) {
IRegion hoverRegion = null;
// go through list of text hovers and return first hover region
ITextHover hover = null;
Iterator i = getTextHovers().iterator();
while ((i.hasNext()) && (hoverRegion == null)) {
hover = (ITextHover) i.next();
hoverRegion = hover.getHoverRegion(viewer, offset);
}
// store the text hover processor that found region
if (hoverRegion != null)
fBestMatchHover = hover;
else
fBestMatchHover = null;
return hoverRegion;
}
Aggregations