Search in sources :

Example 11 with ITextHover

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);
    }
}
Also used : ITextHover(org.eclipse.jface.text.ITextHover)

Example 12 with ITextHover

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);
    }
}
Also used : ITextHover(org.eclipse.jface.text.ITextHover)

Example 13 with ITextHover

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);
    }
}
Also used : ITextHover(org.eclipse.jface.text.ITextHover)

Example 14 with ITextHover

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);
    }
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2) ITextHover(org.eclipse.jface.text.ITextHover) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) Point(org.eclipse.swt.graphics.Point)

Example 15 with ITextHover

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;
}
Also used : ITextHover(org.eclipse.jface.text.ITextHover) Iterator(java.util.Iterator) IRegion(org.eclipse.jface.text.IRegion)

Aggregations

ITextHover (org.eclipse.jface.text.ITextHover)23 IRegion (org.eclipse.jface.text.IRegion)8 Region (org.eclipse.jface.text.Region)5 AbstractCompositeHover (org.eclipse.xtext.ui.editor.hover.AbstractCompositeHover)4 AbstractEditorTest (org.eclipse.xtext.ui.testing.AbstractEditorTest)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 List (java.util.List)3 AnnotationHoverProcessor (org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor)3 ProblemAnnotationHoverProcessor (org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor)3 ITextHoverExtension2 (org.eclipse.jface.text.ITextHoverExtension2)2 ITextViewer (org.eclipse.jface.text.ITextViewer)2 Point (org.eclipse.swt.graphics.Point)2 CompoundRegion (com.liferay.ide.xml.search.ui.editor.CompoundRegion)1 InfoRegion (com.liferay.ide.xml.search.ui.editor.InfoRegion)1 LiferayCustomXmlHover (com.liferay.ide.xml.search.ui.editor.LiferayCustomXmlHover)1 MarkerRegion (com.liferay.ide.xml.search.ui.editor.MarkerRegion)1 TemporaryRegion (com.liferay.ide.xml.search.ui.editor.TemporaryRegion)1 Method (java.lang.reflect.Method)1