Search in sources :

Example 1 with PyEditorTextHoverProxy

use of org.python.pydev.editor.hover.PyEditorTextHoverProxy in project Pydev by fabioz.

the class PyEditConfiguration method getTextHover.

@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
    /**
     * Return the combining hover if the preferences are set accordingly and the state mask matches.
     */
    if (PyHoverPreferencesPage.getCombineHoverInfo()) {
        PyEditorTextHoverDescriptor combiningHover = PydevPlugin.getCombiningHoverDescriptor();
        if (combiningHover.getStateMask() == stateMask) {
            return new PyEditorTextHoverProxy(combiningHover, contentType);
        }
    }
    /**
     * We return the highest priority registered hover whose state mask matches. If two or more hovers
     * have the highest priority, it is indeterminate which will be selected. The proper way to combine
     * hover info is to select that option on the PyDev->Editor->Hover preference page. This will cause
     * the combining hover to be returned by the code above.
     */
    PyEditorTextHoverDescriptor[] hoverDescs = PydevPlugin.getDefault().getPyEditorTextHoverDescriptors();
    int i = 0;
    while (i < hoverDescs.length) {
        if (hoverDescs[i].isEnabled() && hoverDescs[i].getStateMask() == stateMask) {
            return new PyEditorTextHoverProxy(hoverDescs[i], contentType);
        }
        i++;
    }
    return null;
}
Also used : PyEditorTextHoverDescriptor(org.python.pydev.editor.hover.PyEditorTextHoverDescriptor) PyEditorTextHoverProxy(org.python.pydev.editor.hover.PyEditorTextHoverProxy)

Aggregations

PyEditorTextHoverDescriptor (org.python.pydev.editor.hover.PyEditorTextHoverDescriptor)1 PyEditorTextHoverProxy (org.python.pydev.editor.hover.PyEditorTextHoverProxy)1