Search in sources :

Example 1 with PyEditorTextHoverDescriptor

use of org.python.pydev.editor.hover.PyEditorTextHoverDescriptor 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)

Example 2 with PyEditorTextHoverDescriptor

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

the class PydevPlugin method getCombiningHoverDescriptor.

public static PyEditorTextHoverDescriptor getCombiningHoverDescriptor() {
    if (combiningHoverDescriptor == null) {
        combiningHoverDescriptor = new PyEditorTextHoverDescriptor(new PydevCombiningHover());
        initializeDefaultCombiningHoverPreferences();
        PyEditorTextHoverDescriptor.initializeHoversFromPreferences(new PyEditorTextHoverDescriptor[] { combiningHoverDescriptor });
    }
    return combiningHoverDescriptor;
}
Also used : PyEditorTextHoverDescriptor(org.python.pydev.editor.hover.PyEditorTextHoverDescriptor) PydevCombiningHover(org.python.pydev.editor.hover.PydevCombiningHover)

Aggregations

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