Search in sources :

Example 1 with ProblemAnnotationHoverProcessor

use of org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfiguration method getTextHover.

public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
    ITextHover textHover = null;
    /*
		 * Returns a default problem, annotation, and best match hover
		 * depending on stateMask
		 */
    TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
    int i = 0;
    while (i < hoverDescs.length && textHover == null) {
        if (hoverDescs[i].isEnabled() && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
            String hoverType = hoverDescs[i].getId();
            if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
                textHover = new ProblemAnnotationHoverProcessor();
            else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
                textHover = new AnnotationHoverProcessor();
            else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
                textHover = new BestMatchHover(contentType);
            else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType)) {
                ITextHover[] hovers = createDocumentationHovers(contentType);
                if (hovers.length > 0) {
                    textHover = hovers[0];
                }
            }
        }
        i++;
    }
    return textHover;
}
Also used : ITextHover(org.eclipse.jface.text.ITextHover) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor) AnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor) BestMatchHover(org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover)

Example 2 with ProblemAnnotationHoverProcessor

use of org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor in project liferay-ide by liferay.

the class PortletJSPSourceViewerConfiguration method getTextHover.

@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
    ITextHover textHover = null;
    TextHoverManager textHoverManager = SSEUIPlugin.getDefault().getTextHoverManager();
    TextHoverManager.TextHoverDescriptor[] hoverDescs = textHoverManager.getTextHovers();
    int i = 0;
    while ((i < hoverDescs.length) && (textHover == null)) {
        if (hoverDescs[i].isEnabled() && (computeStateMask(hoverDescs[i].getModifierString()) == stateMask)) {
            String hoverType = hoverDescs[i].getId();
            if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = new ProblemAnnotationHoverProcessor();
            } else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = new AnnotationHoverProcessor();
            } else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = (ITextHover) new LiferayCustomXmlHover();
            } else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType)) {
                ITextHover[] hovers = createDocumentationHovers(contentType);
                if (ListUtil.isNotEmpty(hovers)) {
                    textHover = hovers[0];
                }
            }
        }
        i++;
    }
    return textHover;
}
Also used : LiferayCustomXmlHover(com.liferay.ide.xml.search.ui.editor.LiferayCustomXmlHover) ITextHover(org.eclipse.jface.text.ITextHover) AnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor) TextHoverManager(org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor)

Example 3 with ProblemAnnotationHoverProcessor

use of org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor in project liferay-ide by liferay.

the class LiferayCustomXmlViewerConfiguration method getTextHover.

@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
    ITextHover textHover = null;
    /*
		 * Returns a default problem, annotation, and best match hover depending
		 * on stateMask
		 */
    SSEUIPlugin plugin = SSEUIPlugin.getDefault();
    TextHoverManager.TextHoverDescriptor[] hoverDescs = plugin.getTextHoverManager().getTextHovers();
    int i = 0;
    while ((i < hoverDescs.length) && (textHover == null)) {
        if (hoverDescs[i].isEnabled() && (computeStateMask(hoverDescs[i].getModifierString()) == stateMask)) {
            String hoverType = hoverDescs[i].getId();
            if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = new ProblemAnnotationHoverProcessor();
            } else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = new AnnotationHoverProcessor();
            } else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = createDocumentationHover(contentType);
            } else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType)) {
                textHover = createDocumentationHover(contentType);
            }
        }
        i++;
    }
    return textHover;
}
Also used : SSEUIPlugin(org.eclipse.wst.sse.ui.internal.SSEUIPlugin) ITextHover(org.eclipse.jface.text.ITextHover) AnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor) ProblemAnnotationHoverProcessor(org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor)

Aggregations

ITextHover (org.eclipse.jface.text.ITextHover)3 AnnotationHoverProcessor (org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor)3 ProblemAnnotationHoverProcessor (org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor)3 LiferayCustomXmlHover (com.liferay.ide.xml.search.ui.editor.LiferayCustomXmlHover)1 SSEUIPlugin (org.eclipse.wst.sse.ui.internal.SSEUIPlugin)1 BestMatchHover (org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover)1 TextHoverManager (org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager)1