Search in sources :

Example 6 with Syntax

use of aQute.bnd.help.Syntax in project bndtools by bndtools.

the class BndHover method getHoverInfo.

@Deprecated
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
    String info = super.getHoverInfo(textViewer, hoverRegion);
    if (info != null)
        return info;
    if (hoverRegion != null) {
        IDocument doc = textViewer.getDocument();
        try {
            String key = doc.get(hoverRegion.getOffset(), hoverRegion.getLength());
            Syntax syntax = Syntax.HELP.get(key);
            if (syntax == null)
                return null;
            StringBuilder sb = new StringBuilder();
            sb.append(syntax.getLead());
            sb.append("\nE.g. ");
            sb.append(syntax.getExample());
            String text = sb.toString();
            if (text.length() > 30) {
                text = wrap(text, 30);
            }
            return text;
        } catch (Exception e) {
            return e + "";
        }
    }
    return null;
}
Also used : Syntax(aQute.bnd.help.Syntax)

Aggregations

Syntax (aQute.bnd.help.Syntax)6 Description (aQute.lib.getopt.Description)1 Justif (aQute.lib.justif.Justif)1 ArrayList (java.util.ArrayList)1 Formatter (java.util.Formatter)1